Ignore:
Timestamp:
2012-02-16T15:10:43+13:00 (12 years ago)
Author:
kjdon
Message:

extrametadata must have url style filepaths, ie / for dirsep. and they are regex. FileName entires in metadata.xml must be regex, but they allow
on windows for dirsep, which we convert to /

File:
1 edited

Legend:

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

    r24971 r25094  
    158158    $self->{'in_filename'} = 0;
    159159   
    160    
    161160    return bless $self, $class;
    162161}
     
    329328    foreach my $target (@{$self->{'saved_targets'}}) {
    330329   
    331         # Indexing into the extrameta data structures requires the filename's style of slashes to be in URL
    332         # format. But if metadata.xml was user-constructed, its FileName fields (stored in the saved_targets
    333         # map) could represent pathnames in Windows format using \ as file separator, instead of pathnames
    334         # being in URL format as Greenstone would've generated. Need to convert such filepaths to URL style
    335         # paths. Then need convert this to a regex to protect special characters like brackets in the
    336         # filepath, such as "C:\Program Files (x86)\Greenstone".
    337        
    338         $target = &util::unregex_filename($target); # filename is a regex, before converting it to URL form, unregex it
    339         $target = &util::filepath_to_url_format($target); # convert to URL form
    340         $target = &util::filename_to_regex($target); # regex it. Now we have regexed URL form of filename
    341    
    342         my $file_metadata = &extrametautil::getmetadata($self->{'metadataref'}, $target);
     330        # FileNames must be regex, but we allow \\ for path separator on windows. convert to /
     331        $target = &util::filepath_regex_to_url_format($target);
     332        my $file_metadata = &extrametautil::getmetadata($self->{'metadataref'}, $target);
    343333        my $saved_metadata = $self->{'saved_metadata'};
    344334
Note: See TracChangeset for help on using the changeset viewer.