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

struct.error: unpack requires a buffer of 2 bytes thrown when accessing some files #31

Open
abdnh opened this issue Sep 25, 2022 · 0 comments

Comments

@abdnh
Copy link

abdnh commented Sep 25, 2022

I had this error thrown for seemingly random URLs when trying different ZIM files. To reproduce with one sample file:

  1. Download the wikipedia_ar_computer_maxi.zim file from the Kiwix collection (direct link: https://download.kiwix.org/zim/wikipedia_ar_computer_maxi.zim)
  2. Serve the file using ZIMply then navigate to the /w/index.php page.
  3. An error like this is thrown:
2022-09-26 01:08:07 [FALCON] [ERROR] GET /w/index.php => Traceback (most recent call last):
  File "falcon\app.py", line 365, in falcon.app.App.__call__
  File "D:\dev\zimply-demo\venv\lib\site-packages\zimply\zimply.py", line 717, in on_get
    article = ZIMRequestHandler.zim.get_article_by_url(namespace, url)
  File "D:\dev\zimply-demo\venv\lib\site-packages\zimply\zimply.py", line 537, in get_article_by_url
    entry, idx = self._get_entry_by_url(namespace, url)  # get the entry
  File "D:\dev\zimply-demo\venv\lib\site-packages\zimply\zimply.py", line 516, in _get_entry_by_url
    entry = self.read_directory_entry_by_index(middle)
  File "D:\dev\zimply-demo\venv\lib\site-packages\zimply\zimply.py", line 454, in read_directory_entry_by_index
    directory_values = self._read_directory_entry(offset)
  File "D:\dev\zimply-demo\venv\lib\site-packages\zimply\zimply.py", line 435, in _read_directory_entry        
    fields = unpack("<H", self.file.read(2))
struct.error: unpack requires a buffer of 2 bytes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant