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