Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5
    • Component/s: Archivers
    • Labels:
      None

      Description

      The current API is a little awkward when dealing with symlinks (e.g., those created using Info-Zip's "zip -y").

      I propose the following three methods for ZipArchiveEntry:

      public boolean isUnixSymlink()
      
      public String getUnixSymlink(ZipFile zf)
      
      public String getUnixSymlink(ZipFile zf, String pathCharset)
      
      1. COMPRESS-214.patch
        10 kB
        Julius Davies
      2. COMPRESS-214_unix_symlinks.zip
        4 kB
        Julius Davies

        Activity

        Hide
        Julius Davies added a comment -

        Attached a tentative patch for review. Still working on JUnits.

        Show
        Julius Davies added a comment - Attached a tentative patch for review. Still working on JUnits.
        Hide
        Julius Davies added a comment -

        And here's a zip file that will become part of my unit tests. It contains japanese characters:

        e.g.,

        ├── link1 -> ../COMPRESS-214_unix_symlinks/./a/b/c/../../../蓮
        ├── link2 -> ../COMPRESS-214_unix_symlinks/./a/b/c/../../../g
        ├── link3 -> ../COMPRESS-214_unix_symlinks/././a/b/c/../../../直樹
        ├── link4 -> 花子/瑛子
        
        Show
        Julius Davies added a comment - And here's a zip file that will become part of my unit tests. It contains japanese characters: e.g., ├── link1 -> ../COMPRESS-214_unix_symlinks/./a/b/c/../../../蓮 ├── link2 -> ../COMPRESS-214_unix_symlinks/./a/b/c/../../../g ├── link3 -> ../COMPRESS-214_unix_symlinks/././a/b/c/../../../直樹 ├── link4 -> 花子/瑛子
        Hide
        Julius Davies added a comment -

        Here's the patch!

        Show
        Julius Davies added a comment - Here's the patch!
        Hide
        Julius Davies added a comment -

        Committed to trunk.

        Show
        Julius Davies added a comment - Committed to trunk.
        Hide
        Stefan Bodewig added a comment -

        Sorry, I'm a bit late, but a few comments:

        I guess the symlinks are likely written using the same encoding that is used for filenames. ZipFile already has support for that, it might be better to simply reuse that than default to UTF-8. In fact it might be better to move the whole getUnixSymlink to ZipFile For the ZipInputStreamCase a combination of ZipEncoding#decode and reading thwo full content of the entry should work as well.

        Anyway, nice addition, thanks.

        Show
        Stefan Bodewig added a comment - Sorry, I'm a bit late, but a few comments: I guess the symlinks are likely written using the same encoding that is used for filenames. ZipFile already has support for that, it might be better to simply reuse that than default to UTF-8. In fact it might be better to move the whole getUnixSymlink to ZipFile For the ZipInputStreamCase a combination of ZipEncoding#decode and reading thwo full content of the entry should work as well. Anyway, nice addition, thanks.
        Hide
        Julius Davies added a comment -

        Stefan, I'll try and fix it to work in the way you suggested over the next week or two. Thanks for the suggestions!

        Show
        Julius Davies added a comment - Stefan, I'll try and fix it to work in the way you suggested over the next week or two. Thanks for the suggestions!
        Hide
        Stefan Bodewig added a comment -

        I went ahead and moved the method from ZipArchiveEntry to ZipFile in revision 1444779 - and added a tiny bit of documentation with 1444780 so people know how to do it using ZipArchiveInputStream. it would be great if you found the time to review the changes.

        Sorry for being impatient, but I'd love to cut a new release really soon.

        Show
        Stefan Bodewig added a comment - I went ahead and moved the method from ZipArchiveEntry to ZipFile in revision 1444779 - and added a tiny bit of documentation with 1444780 so people know how to do it using ZipArchiveInputStream. it would be great if you found the time to review the changes. Sorry for being impatient, but I'd love to cut a new release really soon.
        Hide
        Julius Davies added a comment - - edited

        Looks great! I fixed a doc typo in rev. 1444954.

        At first I was trying to think if the General-Purpose-Bit's UTF-8 flag could imply that the contents of an entry were also UTF-8.

        But my sense is that flag pertains only to the entry's name, so probably has no bearing on the contents, even if the contents are a symlink.

        Thanks!!!

        Show
        Julius Davies added a comment - - edited Looks great! I fixed a doc typo in rev. 1444954. At first I was trying to think if the General-Purpose-Bit's UTF-8 flag could imply that the contents of an entry were also UTF-8. But my sense is that flag pertains only to the entry's name, so probably has no bearing on the contents, even if the contents are a symlink. Thanks!!!

          People

          • Assignee:
            Julius Davies
            Reporter:
            Julius Davies
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development