Changeset 16904


Ignore:
Timestamp:
2008-08-19T14:56:43+12:00 (13 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
File:
1 edited

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    }
Note: See TracChangeset for help on using the changeset viewer.