Changeset 16638

Show
Ignore:
Timestamp:
04.08.2008 12:32:24 (11 years ago)
Author:
kjdon
Message:

modified store_block_files: includes script (js) files, don't add a block entry if have empty filename, check for %XX in url and resolve to get true filename if necessary

Files:
1 modified

Legend:

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

    r16632 r16638  
    585585    my @embed_matches = ($$textref =~ m/<embed[^>]*?src\s*=\s*($attval)[^>]*>/igs); 
    586586    my @tabbg_matches = ($$textref =~ m/<(?:table|tr|td)[^>]*?background\s*=\s*($attval)[^>]*>/igs); 
    587  
    588     foreach my $link (@img_matches, @usemap_matches, @link_matches, @embed_matches, @tabbg_matches) { 
     587    my @script_matches = ($$textref =~ m/<script[^>]*?src\s*=\s*($attval)[^>]*>/igs); 
     588 
     589    foreach my $link (@img_matches, @usemap_matches, @link_matches, @embed_matches, @tabbg_matches, @script_matches) { 
    589590 
    590591    # remove quotes from link at start and end if necessary 
     
    595596 
    596597    $link =~ s/\#.*$//s; # remove any anchor names, e.g. foo.html#name becomes foo.html 
     598    # some links may just be anchor names 
     599    next unless ($link =~ /\S+/); 
    597600 
    598601    if ($link !~ m@^/@ && $link !~ m/^([A-Z]:?)\\/) { 
     
    602605    } 
    603606    $link = $self->eval_dir_dots($link); 
     607 
     608    # Replace %XX's in URL with decoded value if required.  
     609    # Note that the filename may include the %XX in some situations 
     610    if ($link =~ m/\%[A-F0-9]{2}/i) { 
     611        if (!-e $link) { 
     612        $link =~ s/\%([A-F0-9]{2})/pack('C', hex($1))/ige; 
     613        } 
     614    } 
    604615     
    605616    $block_hash->{'file_blocks'}->{$link} = 1;