Changeset 27222

Show
Ignore:
Timestamp:
18.04.2013 16:05:33 (7 years ago)
Author:
ak19
Message:

Found a bug in a recent change to remove_index_meta where the doublequotes in the 'contains' field of the gdb index was being escaped with a backslash. Backslashes were accumulating in this field each time remove_index_meta was run. Dr Bainbridge fixed this after identifying that there was a for loop specifically escaping the double quotes for the gdbmset operation that was previously used to perform the remove index meta action. The escaping is not necessary for the dbutil::set_infodb_entry method that's now being called instead.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm

    r27180 r27222  
    27692769    my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 
    27702770 
    2771     # Basically loop through and unescape_html the values 
    2772     foreach my $k (keys %$doc_rec) { 
    2773     my @escaped_v = (); 
    2774     foreach my $v (@{$doc_rec->{$k}}) { 
    2775         if ($k eq "contains") { 
    2776         # protect quotes in ".2;".3 etc 
    2777         $v =~ s/\"/\\\"/g; 
    2778         push(@escaped_v, $v); 
    2779         } 
    2780         else { 
    2781         my $ev = &ghtml::unescape_html($v); 
    2782         $ev =~ s/\"/\\\"/g; 
    2783         push(@escaped_v, $ev); 
    2784         } 
    2785     } 
    2786     $doc_rec->{$k} = \@escaped_v; 
    2787     } 
    2788  
    27892771    # Check to make sure the key does exist 
    27902772    if (!defined ($doc_rec->{$metaname})) { 
     
    28172799    $doc_rec->{$metaname} = $filtered_metadata; 
    28182800 
    2819     ## The following code assumes gdbm 
    2820     # Turn the record back to string 
    2821     #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec); 
    2822     # Store it back to the database 
    2823     #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\""; 
    2824     #my $status = system($cmd); 
    2825  
    28262801    ## Use the dbutil set_entry method instead of assuming the database is gdbm 
    28272802    my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec); 
     
    28312806     
    28322807    $mess .= "PATH: $ENV{'PATH'}\n"; 
    2833     #$mess .= "cmd = $cmd\n"; 
    28342808    $mess .= "Exit status: $status\n"; 
    28352809    $mess .= "System Error Message: $!\n"; 
     
    29902964    # Read the docid entry 
    29912965    my $doc_rec = &dbutil::read_infodb_entry($infodbtype, $infodb_file_path, $docid); 
    2992     
    2993     foreach my $k (keys %$doc_rec) { 
    2994     my @escaped_v = (); 
    2995     foreach my $v (@{$doc_rec->{$k}}) { 
    2996         if ($k eq "contains") { 
    2997         # protect quotes in ".2;".3 etc 
    2998         $v =~ s/\"/\\\"/g; 
    2999         push(@escaped_v, $v); 
    3000         } 
    3001         else { 
    3002         my $ev = &ghtml::unescape_html($v); 
    3003         $ev =~ s/\"/\\\"/g; 
    3004         push(@escaped_v, $ev); 
    3005         } 
    3006     } 
    3007     $doc_rec->{$k} = \@escaped_v; 
    3008     } 
    30092966 
    30102967    # Protect the quotes 
     
    30232980    } 
    30242981 
    3025     ## The following code assumes gdbm 
    3026     # Generate the record string 
    3027     #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec); 
    3028     # Store it into GDBM 
    3029     #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\""; 
    3030     #my $status = system($cmd); 
    3031  
    30322982    ## Use the dbutil set_entry method instead of assuming the database is gdbm 
    30332983    my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec); 
     
    30382988     
    30392989    $mess .= "PATH: $ENV{'PATH'}\n"; 
    3040     #$mess .= "cmd = $cmd\n"; 
    30412990    $mess .= "Exit status: $status\n"; 
    30422991    $mess .= "System Error Message: $!\n";