[BACK]Return to cvsweb.cgi CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / cvsweb

Diff for /cvsweb/cvsweb.cgi between version 4.24 and 4.25

version 4.24, 2019/11/26 11:28:43 version 4.25, 2019/11/26 11:53:01
Line 79  use vars qw (
Line 79  use vars qw (
   $tabstop $state $annTable $sel @ForbiddenFiles    $tabstop $state $annTable $sel @ForbiddenFiles
   $use_descriptions %descriptions $dwhere    $use_descriptions %descriptions $dwhere
   $use_moddate $gzip_open $file_list_len    $use_moddate $gzip_open $file_list_len
   $allow_tar @tar_options @gzip_options @zip_options @cvs_options    $allow_tar @tar_options @gzip_options @cvs_options
   @annotate_options @rcsdiff_options    @annotate_options @rcsdiff_options
   $HTML_DOCTYPE $HTML_META $cssurl $CSS    $HTML_DOCTYPE $HTML_META $cssurl $CSS
 );  );
Line 650  if ($input{tarball}) {
Line 650  if ($input{tarball}) {
   
   my ($module)  =  ($where =~ m,^/?(.*),);    # untaint    my ($module)  =  ($where =~ m,^/?(.*),);    # untaint
   $module       =~ s,/([^/]*)$,,;    $module       =~ s,/([^/]*)$,,;
   my ($ext)     =  ($1 =~ /(\.t(?:ar\.)?gz|\.zip)$/);    my ($ext)     =  ($1 =~ /(\.t(?:ar\.)?gz)$/);
   my ($basedir) =  ($module =~ m,([^/]+)$,);    my ($basedir) =  ($module =~ m,([^/]+)$,);
   
   if ($basedir eq '' || $module eq '') {    if ($basedir eq '' || $module eq '') {
Line 658  if ($input{tarball}) {
Line 658  if ($input{tarball}) {
           'You cannot download the top level directory.');            'You cannot download the top level directory.');
   }    }
   
   my $istar = ($ext eq '.tar.gz' || $ext eq '.tgz');    my $istar = $ext eq '.tar.gz' || $ext eq '.tgz';
   if ($istar) {    if ($istar) {
     fatal('500 Internal Error', 'tar command not found.') unless $CMD{tar};      fatal('500 Internal Error', 'tar command not found.') unless $CMD{tar};
     fatal('500 Internal Error', 'gzip command not found.') unless $CMD{gzip};      fatal('500 Internal Error', 'gzip command not found.') unless $CMD{gzip};
   }    } else {
   my $iszip = ($ext eq '.zip');  
   if ($iszip && !$CMD{zip}) {  
     fatal('500 Internal Error', 'zip command not found.');  
   }  
   if (!$istar && !$iszip) {  
     fatal('500 Internal Error', 'Unsupported archive type.');      fatal('500 Internal Error', 'Unsupported archive type.');
   }    }
   
Line 712  if ($input{tarball}) {
Line 707  if ($input{tarball}) {
       my @gzip = ($CMD{gzip}, @gzip_options, '-c');        my @gzip = ($CMD{gzip}, @gzip_options, '-c');
       push(@cmd, \@tar, '|', \@gzip);        push(@cmd, \@tar, '|', \@gzip);
       $ctype = 'application/x-gzip';        $ctype = 'application/x-gzip';
     } elsif ($iszip) {  
       my @zip = ($CMD{zip}, @zip_options, '-r', '-', $basedir);  
       push(@cmd, \@zip, \'');  
       $ctype = 'application/zip';  
     }      }
     push(@cmd, '>pipe', \*TAR_OUT);      push(@cmd, '>pipe', \*TAR_OUT);
   
Line 727  if ($input{tarball}) {
Line 718  if ($input{tarball}) {
       $h->finish();        $h->finish();
     } else {      } else {
       @fatal = ('500 Internal Error',        @fatal = ('500 Internal Error',
                 '%s failure (exit status %s), output: <pre>%s</pre>',                  'tar failure (exit status %s), output: <pre>%s</pre>',
                 $istar ? 'Tar' : 'Zip', $? >> 8 || -1, $err);                  $? >> 8 || -1, $err);
     }      }
   }    }
   
Line 1120  EOF
Line 1111  EOF
   if ($allow_tar && $filesfound) {    if ($allow_tar && $filesfound) {
     my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),);      my ($basefile) = ($where =~ m,(?:.*/)?([^/]+),);
     my $havetar = $CMD{tar} && $CMD{gzip};      my $havetar = $CMD{tar} && $CMD{gzip};
     my $havezip = $CMD{zip};      if (defined($basefile) && $basefile ne '' && $havetar) {
     if (defined($basefile) && $basefile ne '' && ($havetar || $havezip)) {  
       my $q = ($query ? "$query;" : '?') . 'tarball=1';        my $q = ($query ? "$query;" : '?') . 'tarball=1';
       print "<hr />\n",        print "<hr />\n",
         '<div style="text-align: center">Download this directory in ';          '<div style="text-align: center">Download this directory in ';
       # Mangle the filename so browsers show a reasonable filename to download.        # Mangle the filename so browsers show a reasonable filename to download.
       my @types = ();  
       $basefile = uri_escape($basefile);        $basefile = uri_escape($basefile);
       push(@types, &link('tarball', "$basefile.tar.gz$q")) if $havetar;        print &link('tarball', "$basefile.tar.gz$q");
       push(@types, &link('zip archive', "$basefile.zip$q")) if $havezip;        print "</div>\n";
       print join(' or ', @types), "</div>\n";  
     }      }
   }    }
   

Legend:
Removed from v.4.24  
changed lines
  Added in v.4.25

CVSweb