Changeset 16904

Show
Ignore:
Timestamp:
19.08.2008 14:56:43 (11 years ago)
Author:
ak19
Message:

1. The percents in URL-encoded associated images' filenames are only escaped with percent-25s (used in urls referring to URL-encoded filenames) if there aren't any percent-25s already in there. 2. If the html file and assocfiles are already URL encoded it doesn't URL encode them again

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugins/HTMLPlugin.pm

    r16837 r16904  
    11091109    # situations. If the *original* file's name was in URL encoding, the following method will not decode it. 
    11101110    my $utf8_filename = $filename; 
    1111      
    11121111#    print STDERR "*** filename before URL decoding: $filename\n"; 
    11131112    $filename = $self->opt_url_decode($utf8_filename); 
     
    11501149    return "_httpdocimg_/$newname"; 
    11511150    } else { 
    1152     ($newname) = $utf8_filename =~ m/([^\/\\]*)$/; 
    1153      
     1151    if(&unicode::is_url_encoded($utf8_filename)) { 
     1152        # use the possibly-decoded filename instead to avoid double URL encoding 
     1153        ($newname) = $filename =~ m/([^\/\\]*)$/; 
     1154    } else { 
     1155        ($newname) = $utf8_filename =~ m/([^\/\\]*)$/; 
     1156    } 
    11541157#   print STDERR "Before url encoding newname: $newname\n"; 
    11551158    # Make sure this name uses only ASCII characters  
     
    11641167    # of filenames, URL-encode the additional percent signs of the URL-encoded filename 
    11651168    my $newname_url = $newname; 
    1166     $newname_url =~ s/%/%25/g; 
     1169    $newname_url =~ s/%/%25/g if $newname_url !~ m/%25/; 
    11671170    return "_httpdocimg_/$newname_url";  
    11681171    }