Subject: | Problem with directory named "0" |
This is a variation on RT #27463, except the issue here is when a
directory name is "0".
The problem can be triggered using the zip.pl script in the examples
directory
$ mkdir fred fred/0 fred/1
$ perl examples/zip.pl z.zip fred/*
Now check what is in the zip file - note the missing fred/0/ directory
entry
$ unzip -l z.zip
Archive: z.zip
Length Date Time Name
--------- ---------- ----- ----
0 2011-08-30 16:55 fred/
0 2011-08-30 16:55 fred/1/
--------- -------
0 2 files
The patch below fixed the issue for me.
*** lib/Archive/Zip.pm.orig 2011-08-30 16:59:49.000000000 +0100
--- lib/Archive/Zip.pm 2011-08-30 16:59:54.000000000 +0100
***************
*** 519,525 ****
File::Spec->splitpath( File::Spec->canonpath($name), $forceDir
);
$$volReturn = $volume if ( ref($volReturn) );
my @dirs = map { $_ =~ s{/}{_}g; $_ } File::Spec-
Show quoted text
>splitdir($directories);
! if ( @dirs > 0 ) { pop (@dirs) unless $dirs[-1] } # remove empty
component
push ( @dirs, defined($file) ? $file : '' );
#return wantarray ? @dirs : join ( '/', @dirs );
--- 519,525 ----
File::Spec->splitpath( File::Spec->canonpath($name), $forceDir
);
$$volReturn = $volume if ( ref($volReturn) );
my @dirs = map { $_ =~ s{/}{_}g; $_ } File::Spec-
Show quoted text>splitdir($directories);
! if ( @dirs > 0 ) { pop (@dirs) if $dirs[-1] eq '' } # remove
empty component
push ( @dirs, defined($file) ? $file : '' );
#return wantarray ? @dirs : join ( '/', @dirs );
cheers
Paul