Ignore:
Timestamp:
2012-01-06T16:07:14+13:00 (12 years ago)
Author:
ak19
Message:

Dr Bainbridge fixed the problem identified by Blandine and Silver in the mailing list where moving files from one subfolder to another within an existing remote collection would fail if the filename had about 32 or more characters in it (even though the characters were plain ASCII). The reason turned out to be that the feedback\Base64.java class was set to break lines after 76 characters when encoding strings into Base64. This is what happened when Base64 encoding filenames which then got moved about. This is now fixed in feedback\Base64.java with the new method encodeBytesInSingleLine() which sets the base64 encoding options to not break the lines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/remote/RemoteGreenstoneServerAction.java

    r22470 r24915  
    151151        String delete_collection_file_command = "cmd=delete-collection-file";
    152152        delete_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    153         delete_collection_file_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
     153        delete_collection_file_command += "&file=" + Base64.encodeBytesInSingleLine(collection_file_relative_path.getBytes());
    154154        action_output = remote.sendCommandToServer(delete_collection_file_command, null);
    155155    }
     
    312312        file_exists_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    313313        // base64 encode the filename to preserve special characters
    314         file_exists_command += "&file=" + Base64.encodeBytes(collection_file_relative_path.getBytes());
     314        file_exists_command += "&file=" + Base64.encodeBytesInSingleLine(collection_file_relative_path.getBytes());
    315315
    316316        // returns either "File <filename> exists" or "File <filename> does not exist"
     
    476476        String move_collection_file_command = "cmd=move-collection-file";
    477477        move_collection_file_command += "&c=" + URLEncoder.encode(collection_name.replace(File.separatorChar, '|'), "UTF-8");
    478         move_collection_file_command += "&source=" + Base64.encodeBytes(source_collection_file_relative_path.getBytes());
    479         move_collection_file_command += "&target=" + Base64.encodeBytes(target_collection_file_relative_path.getBytes());
     478        move_collection_file_command += "&source=" + Base64.encodeBytesInSingleLine(source_collection_file_relative_path.getBytes());
     479        move_collection_file_command += "&target=" + Base64.encodeBytesInSingleLine(target_collection_file_relative_path.getBytes());
    480480        //move_collection_file_command += "&source=" + URLEncoder.encode(source_collection_file_relative_path, "UTF-8");
    481481        //move_collection_file_command += "&target=" + URLEncoder.encode(target_collection_file_relative_path, "UTF-8");
Note: See TracChangeset for help on using the changeset viewer.