You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2012/02/28 14:35:31 UTC

Re: svn commit: r1294460 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/zip/ test/java/org/apache/commons/compress/archivers/zip/ test/resources/

On 28 February 2012 05:00,  <bo...@apache.org> wrote:
> Author: bodewig
> Date: Tue Feb 28 05:00:26 2012
> New Revision: 1294460
>
> URL: http://svn.apache.org/viewvc?rev=1294460&view=rev
> Log:
> add workaround for broken implementations that use backslashes rather than slashes in file names.  COMPRESS-176
>
> Added:
>    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java   (with props)
>    commons/proper/compress/trunk/src/test/resources/test-winzip.zip   (with props)
> Modified:
>    commons/proper/compress/trunk/src/changes/changes.xml
>    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
>    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
>
> Modified: commons/proper/compress/trunk/src/changes/changes.xml
> URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1294460&r1=1294459&r2=1294460&view=diff
> ==============================================================================
> --- commons/proper/compress/trunk/src/changes/changes.xml (original)
> +++ commons/proper/compress/trunk/src/changes/changes.xml Tue Feb 28 05:00:26 2012
> @@ -46,6 +46,10 @@ The <action> type attribute can be add,u
>   <body>
>     <release version="1.4" date="unreleased"
>              description="Release 1.4">
> +      <action issue="COMPRESS-176" type="update" date="2012-02-28">
> +        Added a workaround for a Bug in WinZIP which uses backslashes
> +        as path separators in Unicode Extra Fields.
> +      </action>
>       <action issue="COMPRESS-131" type="update" date="2012-02-23">
>         ArrayOutOfBounds while decompressing bz2. Added test case - code already seems to have been fixed.
>       </action>
>
> Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
> URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java?rev=1294460&r1=1294459&r2=1294460&view=diff
> ==============================================================================
> --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java (original)
> +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java Tue Feb 28 05:00:26 2012
> @@ -509,6 +509,10 @@ public class ZipArchiveEntry extends jav
>      * @param name the name to use
>      */
>     protected void setName(String name) {
> +        if (name != null && getPlatform() == PLATFORM_FAT
> +            && name.indexOf("/") == -1) {
> +            name = name.replace('\\', '/');
> +        }
>         this.name = name;
>     }

The original problem is with unicode extra fields only.

Would it not be safer to apply the fix to the method
setNameAndCommentFromExtraFields where it actually calls setName?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1294460 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/zip/ test/java/org/apache/commons/compress/archivers/zip/ test/resources/

Posted by Stefan Bodewig <bo...@apache.org>.
On 2012-02-28, sebb wrote:

> On 28 February 2012 05:00,  <bo...@apache.org> wrote:
>>     protected void setName(String name) {
>>+         if (name != null && getPlatform() == PLATFORM_FAT
>>+             && name.indexOf("/") == -1) {
>>+             name = name.replace('\\', '/');
>>+         }
>>         this.name = name;
>>     }

> The original problem is with unicode extra fields only.

The InfoZIP workaround replicated here is not conditional, it seems
there are other broken ZIPs that use backslashes in plain names as well.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org