Changeset 33749


Ignore:
Timestamp:
2019-12-04T15:58:47+13:00 (4 years ago)
Author:
ak19
Message:

Still on the bugfix for GLI with non-ascii filenames assigned file-level metadata. Also needed to add the Linux fix for the case of replacing and removing metadata.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFile.java

    r33748 r33749  
    296296        // so need to make sure everything hex has been decoded (no more hex) to compare apples with apples     
    297297        if (hexdecoded_regexed_file_relative_path.matches(hexdecoded_current_filename_element_value)) { //if (file_relative_path.matches(current_filename_element_value)) {
    298             //System.err.println("   @@@ Found a match in meta.xml for hexdecoded_regexed_file_relative_path: " + hexdecoded_regexed_file_relative_path + "\n");
     298                //System.err.println("   @@@ Found a match in meta.xml for hexdecoded_regexed_file_relative_path: " + hexdecoded_regexed_file_relative_path + "\n");
    299299            current_fileset_matches = true;
    300300            if (!file_relative_path.equals("") && current_filename_element_value.equals(DIRECTORY_FILENAME)) {
     
    414414    // Determine the file's path relative to the location of the metadata.xml file
    415415    String metadata_xml_file_directory_path = FilenameEncoding.fileToURLEncoding(getParentFile());
    416     String file_relative_path = file_node.getURLEncodedFilePath().substring(metadata_xml_file_directory_path.length());
     416    String file_relative_path = file_node.getURLEncodedFilePath();
     417    if(!FilenameEncoding.MULTIPLE_FILENAME_ENCODINGS_SUPPORTED) {
     418        file_relative_path = file_relative_path.replace("&", FilenameEncoding.HEX_ENTITY_AMPERSAND);
     419    }
     420    file_relative_path = file_relative_path.substring(metadata_xml_file_directory_path.length());
    417421    if (file_relative_path.startsWith(FilenameEncoding.URL_FILE_SEPARATOR)) {
    418422        file_relative_path = file_relative_path.substring(FilenameEncoding.URL_FILE_SEPARATOR.length());
     
    533537    // Determine the file's path relative to the location of the metadata.xml file
    534538    String metadata_xml_file_directory_path = FilenameEncoding.fileToURLEncoding(getParentFile());
    535     String file_relative_path = file_node.getURLEncodedFilePath().substring(metadata_xml_file_directory_path.length());
     539    String file_relative_path = file_node.getURLEncodedFilePath();
     540    if(!FilenameEncoding.MULTIPLE_FILENAME_ENCODINGS_SUPPORTED) {
     541        file_relative_path = file_relative_path.replace("&", FilenameEncoding.HEX_ENTITY_AMPERSAND);
     542    }
     543    file_relative_path = file_relative_path.substring(metadata_xml_file_directory_path.length());   
    536544    if (file_relative_path.startsWith(FilenameEncoding.URL_FILE_SEPARATOR)) {
    537545        file_relative_path = file_relative_path.substring(FilenameEncoding.URL_FILE_SEPARATOR.length());
Note: See TracChangeset for help on using the changeset viewer.