On 28 February 2012 05:00,  <bode...@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-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to