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

Tar file breaks dataset viewer #1089

Open
donkirkby opened this issue Nov 18, 2020 · 1 comment
Open

Tar file breaks dataset viewer #1089

donkirkby opened this issue Nov 18, 2020 · 1 comment

Comments

@donkirkby
Copy link
Member

A container generated a tar file of png files, and then the server displayed an error page when we went to view the dataset.

Traceback:

File "/opt/venv_kive/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/opt/venv_kive/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/opt/venv_kive/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/venv_kive/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)

File "/usr/local/share/Kive/kive/librarian/views.py" in dataset_view
  144.                 sample_content = data_handle.read(1000)

File "/usr/lib64/python3.6/encodings/ascii.py" in decode
  26.         return codecs.ascii_decode(input, self.errors)[0]

Exception Type: UnicodeDecodeError at /dataset_view/1820806
Exception Value: 'ascii' codec can't decode byte 0x89 in position 1536: ordinal not in range(128)

I think we use a utility that tries to identify binary files, maybe it doesn't work with tar files. We should be able to catch the exception and then treat the file as binary.

@donkirkby donkirkby added the bug label Nov 18, 2020
@donkirkby donkirkby added this to the 0.17 - Collate data sets milestone Nov 18, 2020
@donkirkby
Copy link
Member Author

I'm seeing the same error with PDF files. Workaround: download them through the API.

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

No branches or pull requests

1 participant