2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 20:52:13 +00:00

01_FHEMWEB.pm: fix % in Filenames (Forum #69164)

git-svn-id: https://svn.fhem.de/fhem/trunk@13745 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-20 09:36:17 +00:00
parent 6c5c6f0daf
commit ba244225c4
2 changed files with 10 additions and 2 deletions

View File

@ -775,7 +775,7 @@ FW_answerCall($)
$dir =~ s/\.\.//g;
$dir =~ s,www/,,g; # Want commandref.html to work from file://...
my $file = $ofile;
my $file = urlDecode($ofile); # 69164
$file =~ s/\?.*//; # Remove timestamp of CSS reloader
if($file =~ m/^(.*)\.([^.]*)$/) {
$file = $1; $ext = $2;
@ -2398,6 +2398,7 @@ FW_makeImage(@)
}
} else {
$class = "class='$class'" if($class);
$p = urlEncodePath($p);
return "<img $class src=\"$FW_ME/images/$p\" alt=\"$txt\" title=\"$txt\">";
}
}

View File

@ -46,7 +46,14 @@ filename2MIMEType($) {
sub
urlEncode($) {
$_= $_[0];
s/([\x00-\x2F,\x3A-\x40,\x5B-\x60,\x7B-\xFF])/sprintf("%%%02x",ord($1))/eg;
s/([\x00-\x2F \x3A-\x40 \x5B-\x60 \x7B-\xFF])/sprintf("%%%02x",ord($1))/eg;
return $_;
}
sub
urlEncodePath($) {
$_= $_[0];
s/([\x00-\x20 \x25 \x3F \x7B-\xFF])/sprintf("%%%02x",ord($1))/eg;
return $_;
}