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/doc.pm

    r33756 r33757  
    298298    my @dirs = ($sep eq "\\") ? split(/[\\\/]+/, $dirname) : split(/\//, $dirname);
    299299   
    300     my $dirpath = "";   
     300    my $dirpath = "";
     301   
     302    # Don't encode the first folder ("import" or "tmp"): GLI's DocXMLFile.java looks for literal "import"
     303    # or "tmp" before it knows what the file rename method to be used decode the rest of gsdlsourcefilename is.
     304    if(scalar (@dirs) > 1) {
     305        $dirpath = shift(@dirs);
     306    }
    301307    foreach my $subdir (@dirs) {
    302     ##print STDERR "@@@@ Found subdir: $subdir\n";
    303    
    304     # The import folder can be called anything, including in non-ASCII encodings.
    305     # Don't need to avoid encoding default import folder called "import", as it gets
    306     # URL/base64 encoded to ITSELF.
    307     # But can't encode (URL/base64 encode) any $ENV{'GSDLIMPORTDIR'} though if it's set,
    308     # as BasePlugout::get_doc_dir() removes any $ENV{'GSDLIMPORTDIR'} prefix. Because if
    309     # the $ENV{'GSDLIMPORTDIR'} part of gsdlsourcefilename is encoded here, the prefix
    310     # won't match with $ENV{'GSDLIMPORTDIR'}
    311 
    312     unless ($ENV{'GSDLIMPORTDIR'} && $subdir eq $ENV{'GSDLIMPORTDIR'}) {
    313         $subdir = &util::rename_file($subdir, $rename_method);
    314     }
     308    print STDERR "@@@@ Found subdir: $subdir\n";
     309   
     310    $subdir = &util::rename_file($subdir, $rename_method);
     311    #print STDERR "@@@@ encoded subdir: $subdir\n";
     312   
    315313    $dirpath = &FileUtils::filenameConcatenate($dirpath, $subdir);
    316314    }
Note: See TracChangeset for help on using the changeset viewer.