Changeset 28067

Show
Ignore:
Timestamp:
15.08.2013 16:46:52 (6 years ago)
Author:
ak19
Message:

Fixing the numerous overly greedy regular expressions concerning timestamped tmp folders, after testing that the fixes still work with affected previous collections (PDFBox) and that they also behave correctly correctly with a new affected collection (Multimedia)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm

    r28019 r28067  
    186186    (my $gsdlhome_re = $ENV{'GSDLHOME'}) =~ s@\\@\/@g;       
    187187    $gsdlhome_re = ".*" unless $$ENV{'GSDLHOME'}; 
    188     my $tmpfile_regex = "<URL>http://$gsdlhome_re/tmp/([^\.]*)(\..{3,4})"; # $gsdlhome/tmp/randomfilename.html, file ext can be 3 or 4 chars long            
     188    my $tmpfile_regex = "<URL>http://$gsdlhome_re/tmp/([^\.]*?)(\..{3,4})"; # $gsdlhome/tmp/randomfilename.html, file ext can be 3 or 4 chars long           
    189189    if($test_text =~ m@$tmpfile_regex@g) {           
    190190        # found a match, replace the tmp file name with "random", keeping the original file extension  
     
    198198     
    199199         
    200         $tmpfile_regex = "(<(URL|UTF8URL|gsdlconvertedfilename|OrigSource)>(http://)?)($gsdlhome_re)?(/tmp/)?.*(\..{3,4})"; 
     200        $tmpfile_regex = "(<(URL|UTF8URL|gsdlconvertedfilename|OrigSource)>(http://)?)($gsdlhome_re)?(/tmp/)?.*?(\..{3,4})"; 
    201201        if($5) {  
    202202            $test_text =~ s@$tmpfile_regex@$1$5$new_tmp_filename$6@mg; 
     
    206206         
    207207        # modelcol used a different gsdlhome, but also a tmp dir, so make the same changes to its random filename            
    208         $tmpfile_regex = "(<(URL|UTF8URL|gsdlconvertedfilename|OrigSource)>(http://)?)(.*)?(/tmp/)?.*(\..{3,4})"; 
     208        $tmpfile_regex = "(<(URL|UTF8URL|gsdlconvertedfilename|OrigSource)>(http://)?)(.*)?(/tmp/)?.*?(\..{3,4})"; 
    209209        if($5) {  
    210210            $model_text =~ s@$tmpfile_regex@$1$5$new_tmp_filename$6@mg; 
     
    219219        #$test_text =~ s@\[http://.*/tmp/.*(\..{3,4})\]@tmp/random$1@mg; # HASH OIDs can appear in different order 
    220220        #$model_text =~ s@\[http://.*/tmp/.*(\..{3,4})\]@tmp/random$1@mg; 
    221         $test_text =~ s@\[http://.*/tmp/.*(\..{3,4})\]\n<section>[^\n]*\n@tmp/random$1\n<section>RandomHash\n@sg; 
    222         $model_text =~ s@\[http://.*/tmp/.*(\..{3,4})\]\n<section>[^\n]*\n@tmp/random$1\n<section>RandomHash\n@sg; 
     221         
     222        $test_text  =~ s@\[http://[^\n]*?/tmp/.*?(\..{3,4})\]\n<section>([^\n]*?)\n@tmp/random$1\n<section>$2\n@sg; 
     223        $model_text =~ s@\[http://[^\n]*?/tmp/.*?(\..{3,4})\]\n<section>([^\n]*?)\n@tmp/random$1\n<section>$2\n@sg; 
    223224    }    
    224225