Ignore:
Timestamp:
2019-12-07T01:40:13+13:00 (4 years ago)
Author:
ak19
Message:
  1. Windows bugfix for getting exMeta to be loaded into GLI where there are subdirs involved in the Gather pane, or there are non-ASCII filenames, or the file rename method is set to base64. 2. Bugfix for Linux and Windows: Using Base64 to rename files was still a problem despite the previous commit (which was supposed to have fixed all GLI exMeta loading issues on Linux) in the special case where a subfolder was pure ASCII. The perl code wouldn't base64 encode such subdirs. However, GLI won't know which part of a relative file path to decode based on the file rename method used and which parts are not to be decoded. So GLI uniformly decoded them, and ASCII named subfolders that were not base64 encoded (but contained files that were to be renamed with base64) got base64 decoded into garbage, so that exMeta still did not get attached. 3. This commit contains debug stmts.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/unicode.pm

    r33299 r33757  
    697697}
    698698
     699# Base64 encoding does not encode a pure ASCII to itself. This is important to know.
     700# If the $force_encode parameter is true, then this method WILL base64 encode whatever
     701# string is passed in, including any plain ASCII string.
     702# That means this method could double encode an already encoded string.
     703# However, this method is necessary because on the GLI end, we can't detect whether a plain
     704# ASCII string has been encoded or not. And if gsdlsourcefilerenamemethod is set to base64,
     705# then gli will always attempt to decode all parts of the relative path gsdlsourcefilename
     706# (except the "import" prefix, which is special) or none of the parts.
     707sub force_base64_encode {
     708    my ($text) = @_;
     709    my $force_encode = 1;
     710    return &base64_encode($text, $force_encode);
     711}
     712
    699713sub base64_encode {
    700     my ($text) = @_;
    701     if(!&conforms_to_mod_base64($text)) {
     714    my ($text, $force_encode) = @_;
     715    if($force_encode || !&conforms_to_mod_base64($text)) {
    702716    # return entity for underscore to underscore before encoding
    703717    $text =~ s/&\#095;/_/g;
Note: See TracChangeset for help on using the changeset viewer.