Changeset 32325


Ignore:
Timestamp:
2018-08-06T20:04:55+12:00 (6 years ago)
Author:
ak19
Message:

Dr Bainbridge worked out the solution to HTMLPlugin not handling embedded base64 encoded images. Fixed!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/HTMLPlugin.pm

    r32096 r32325  
    230230    # some links may just be anchor names
    231231    next unless ($raw_link =~ /\S+/);
    232 
     232    # don't block embedded images, which start with src="data:image..."
     233    next if($raw_link =~ m@data\:image@);
     234   
    233235    if ($raw_link !~ m@^/@ && $raw_link !~ m/^([A-Z]:?)\\/i) {
    234236        # Turn relative file path into full path
     
    796798    $file, $doc_obj, $section) = @_;
    797799
     800    # don't modify embedded images. These start with data:image and are base-64 encoded. Return them as is
     801    # If we let this method proceed, it will not just mark embedded images as "external links", but will wrongly
     802    # clean up double slashes in the base-64 encoded part as single slash, which clobbers the encoding/image.
     803    return ($front . $link .$back) if($link =~ m@^[\"\']?data\:image@);
     804
     805   
    798806    # remove quotes from link at start and end if necessary
    799807    if ($link=~/^[\"\']/) {
Note: See TracChangeset for help on using the changeset viewer.