- Timestamp:
- 2019-12-03T15:04:32+13:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/metadata/MetadataXMLFile.java
r33739 r33744 668 668 } 669 669 670 String curr_directory_path = FilenameEncoding.filenameToURLEncoding("."); 671 curr_directory_path = curr_directory_path.substring(0, curr_directory_path.length()-2); // cut off /. at end 672 //System.err.println("@@@ curr_directory_path: " + curr_directory_path); 670 String curr_directory_path = FilenameEncoding.fullFilepathToURLEncoding("."); 671 672 //String curr_directory_path = FilenameEncoding.filenameToURLEncoding("."); 673 //curr_directory_path = curr_directory_path.substring(0, curr_directory_path.length()-2); // cut off /. at end 674 System.err.println("@@@ curr_directory_path: " + curr_directory_path); 673 675 674 676 //System.err.println("PARSED loaded_file contains:\n" + XMLTools.elementToString(doc.getDocumentElement(), true)); … … 687 689 // Reencode filename after parseXML() had the side-effect of decoding entities in filename elements 688 690 689 //System.err.println("Filename before reencoding was: " + filename);691 System.err.println("Filename before reencoding was: " + filename); 690 692 691 693 // Can't convert to URI with backslash-escaped chars (backslash used in regexed filename are illegal in URI object 692 694 // created by filenameToURLEncoding). So replace backslashes in regex with url-encoded hex-value of backslash, %5C. 693 695 String encoded_filename = filename.replace("\\", "%5C"); 696 697 /* 694 698 encoded_filename = FilenameEncoding.filenameToURLEncoding(encoded_filename); 695 696 699 // now lop off the metadataxml dir prefix the FilenameEncoding.filenameToURLEncoding(STRING) variant would have added 697 700 encoded_filename = encoded_filename.substring(curr_directory_path.length()); … … 699 702 encoded_filename = encoded_filename.substring(FilenameEncoding.URL_FILE_SEPARATOR.length()); 700 703 } 701 704 */ 705 706 // get the URL encoded filename preserving special encodings, with any curr_directory_path prefix removed 707 encoded_filename = FilenameEncoding.filenameToURLEncodingWithPrefixRemoved(encoded_filename, curr_directory_path); 708 702 709 // Reintrodudce the backslash characters in place of their %5C hex placeholders 703 710 encoded_filename = encoded_filename.replace("%5C", "\\"); … … 705 712 // Update filename element in DOM 706 713 XMLTools.setElementTextValue(filename_element, encoded_filename); 707 //System.err.println("Filename after reencoding was: " + encoded_filename);714 System.err.println("Filename after reencoding was: " + encoded_filename); 708 715 } 709 716 }
Note:
See TracChangeset
for help on using the changeset viewer.