Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename decoding issue for zip files archived by macOS #74

Open
Wh1isper opened this issue Nov 24, 2021 · 4 comments
Open

Filename decoding issue for zip files archived by macOS #74

Wh1isper opened this issue Nov 24, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@Wh1isper
Copy link

Wh1isper commented Nov 24, 2021

Description

just the same as weichsel/ZIPFoundation#63
python zipfile lib using flag to determind the encoding of the file https://github.com/python/cpython/blob/main/Lib/zipfile.py#L1384 but osx compress won't set that
so we may need to guess the encoding for zip

Reproduce

  1. Go to '...'
  2. Click on '...'
  3. Scroll down to '...'
  4. See error '...'

Expected behavior

Context

  • Python package version:
  • Extension version:
  • Operating System and its version:
  • Browser and its version:
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Web Browser Output
Paste the output from your browser web console here.
@Wh1isper
Copy link
Author

I will provide a broken zip later
and here is how I solve this problem https://github.com/jupyterlab-contrib/jupyter-archive/pull/75/files
feel free to improve it
thanks

@Wh1isper
Copy link
Author

Wh1isper commented Dec 1, 2021

I have provided a less elegant solution in my branch with two main problems

  1. using try ... encode to probe the encoding, efficiency and accuracy are not guaranteed
  2. need to decompress to a temporary folder before decoding and moving, which further reduces efficiency; if using read for writing, we have to determine whether the path represents a file or a folder

@fcollonval
Copy link
Member

thanks for trying providing a solution and reported back.

@Wh1isper
Copy link
Author

This is actually a cross-platform issue, caused by the default zip implementation of mac and windows not matching the protocol.

We provide a new implementation, but in fact the encoding incompatibility problem of windows is related to the language used by the user, currently it is only compatible with gbk(Chinese)

#108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants