Changeset 19172

Show
Ignore:
Timestamp:
21.04.2009 18:55:14 (10 years ago)
Author:
ak19
Message:

GLI and gliserver.pl have been updated together to deal with inconsistent Zipping environment. When testing on Linux, LANG variable was set on the GLI (client) side but not set on server side. This resulted in special characters in filenames being unzipped differently from their originals on the client side, or if the LANG env var had been set to be the same on the server end as it was on the client end when the zipping took place. Now the client passes the LANG variable to every upload and download gliserver command. The client gets and stores the LANG variable only once though (on creating the RemoteGreenstoneServer? object) since the System.getenv() method is deprecated.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/cgi-bin/gliserver.pl

    r19137 r19172  
    492492    $gsdl_cgi->generate_error("No collection specified."); 
    493493    } 
     494     
     495    # language and region Environment Variable setting on the client side that was used to zip files. 
     496    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     497    $gsdl_cgi->delete("lr"); 
    494498 
    495499    # Ensure the user is allowed to edit this collection 
     
    517521    } 
    518522    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipCollectionShell $java_args";  
     523    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    519524 
    520525    my $java_output = `$java_command`; 
     
    543548    } 
    544549 
     550    # language and region Environment Variable setting on the client side that was used to zip files. 
     551    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     552    $gsdl_cgi->delete("lr"); 
     553    
    545554    # Ensure the user is allowed to edit this collection 
    546555    &authenticate_user($gsdl_cgi, $username, $collection, $site); 
     
    563572    my $java_args = "\"$zip_file_path\" \"$collect_directory\" \"$collection\""; 
    564573    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipCollectionArchives $java_args";  
     574    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    565575 
    566576    my $java_output = `$java_command`; 
     
    584594{ 
    585595    my ($gsdl_cgi, $username, $timestamp, $site) = @_; 
     596 
     597    # language and region Environment Variable setting on the client side that was used to zip files. 
     598    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     599    $gsdl_cgi->delete("lr"); 
    586600    
    587601    # Users can be in any group to perform this action 
     
    597611    my $java_args = "\"$zip_file_path\" \"$collect_directory\" \"$username\" \"$user_groups\""; 
    598612    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipCollectionConfigurations $java_args";  
     613    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    599614    my $java_output = `$java_command`; 
    600615    my $java_status = $?; 
     
    653668    $gsdl_cgi->generate_error("No collection specified."); 
    654669    } 
     670    # language and region Environment Variable setting on the client side that was used to zip files. 
     671    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     672    $gsdl_cgi->delete("lr"); 
    655673    my $file = $gsdl_cgi->clean_param("file"); 
    656674    if ((!defined $file) || ($file =~ m/^\s*$/)) { 
     
    685703    my $java_args = "\"$zip_file_path\" \"$collection_directory\" \"$file\""; 
    686704    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipFiles $java_args";  
     705    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    687706 
    688707    my $java_output = `$java_command`; 
     
    709728    my $user_groups = &authenticate_user($gsdl_cgi, $username, "", $site); 
    710729 
     730    # language and region Environment Variable setting on the client side that was used to zip files. 
     731    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     732    $gsdl_cgi->delete("lr"); 
    711733    my $file = $gsdl_cgi->clean_param("file"); 
    712734    if ((!defined $file) || ($file =~ m/^\s*$/)) { 
     
    734756    my $java_args = "\"$zip_file_path\" \"$web_inf_directory\" \"$file\""; 
    735757    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.ZipFiles $java_args";  
     758    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    736759    my $java_output = `$java_command`; 
    737760 
     
    10521075    my $zip = $gsdl_cgi->clean_param("zip"); 
    10531076 
     1077    # language and region Environment Variable setting on the client side that was used to 
     1078    # zip files. This needs to be consistent on both client and server sides, otherwise zip  
     1079    # and unzip seem to produce different values. 
     1080    my $client_lang = $gsdl_cgi->clean_param("lr"); 
     1081    $gsdl_cgi->delete("lr"); 
     1082 
    10541083    # Make sure we don't try to upload anything outside the collection 
    10551084    if ($file =~ m/\.\./) { 
     
    11311160    my $java_args = "\"$file_path\" \"$directory_path\""; 
    11321161    my $java_command = "\"$java\" -classpath \"$java_classpath\" org.greenstone.gatherer.remote.Unzip $java_args";  
    1133  
     1162    $java_command = "LANG=$client_lang $java_command" if $client_lang; 
    11341163    my $java_output = `$java_command`; 
    11351164    my $java_status = $?;