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

Raise Message Exception when displaying binary data #18503

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Jul 5, 2024

Fixes
https://sentry.galaxyproject.org/share/issue/a8843884527f4e4089b32fd14a2f126d/:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 4: invalid start byte
  File "galaxy/web/framework/middleware/error.py", line 167, in __call__
    app_iter = self.application(environ, sr_checker)
  File "galaxy/web/framework/middleware/statsd.py", line 29, in __call__
    req = self.application(environ, start_response)
  File "/cvmfs/main.galaxyproject.org/venv/lib/python3.11/site-packages/paste/httpexceptions.py", line 635, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/base.py", line 174, in __call__
    return self.handle_request(request_id, path_info, environ, start_response)
  File "galaxy/web/framework/base.py", line 263, in handle_request
    body = method(trans, **kwargs)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 152, in display
    display_data, headers = data.datatype.display_data(
  File "galaxy/datatypes/sequence.py", line 785, in display_data
    "/dataset/large_file.mako", truncated_data=fh.read(max_peek_size), data=dataset
  File "<frozen codecs>", line 322, in decode

Which is a BAM file assigned to fastqsanger.gz

Screenshot 2024-07-05 at 17 16 44

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    Upload a bam dataset, assign it as fastqsanger.gz and click on the eye icon.

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Fixes
https://sentry.galaxyproject.org/share/issue/a8843884527f4e4089b32fd14a2f126d/:
```
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 4: invalid start byte
  File "galaxy/web/framework/middleware/error.py", line 167, in __call__
    app_iter = self.application(environ, sr_checker)
  File "galaxy/web/framework/middleware/statsd.py", line 29, in __call__
    req = self.application(environ, start_response)
  File "/cvmfs/main.galaxyproject.org/venv/lib/python3.11/site-packages/paste/httpexceptions.py", line 635, in __call__
    return self.application(environ, start_response)
  File "galaxy/web/framework/base.py", line 174, in __call__
    return self.handle_request(request_id, path_info, environ, start_response)
  File "galaxy/web/framework/base.py", line 263, in handle_request
    body = method(trans, **kwargs)
  File "galaxy/webapps/galaxy/controllers/dataset.py", line 152, in display
    display_data, headers = data.datatype.display_data(
  File "galaxy/datatypes/sequence.py", line 785, in display_data
    "/dataset/large_file.mako", truncated_data=fh.read(max_peek_size), data=dataset
  File "<frozen codecs>", line 322, in decode

```
Which is a BAM file assigned to fastqsanger.gz
@galaxyproject-sentryintegration

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: lib/galaxy/datatypes/sequence.py

Function Unhandled Issue
display_data UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdc in position 12: invalid continuation byte /...
Event Count: 4
display_data FileNotFoundError: [Errno 2] No such file or directory: '' /datasets/11ac94870d0bb33a3f5014b2370c828...
Event Count: 2
📄 File: lib/galaxy/datatypes/tabular.py (Click to Expand)
Function Unhandled Issue
get_chunk UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 0: invalid continuation byte /d...
Event Count: 3
---

Did you find this useful? React with a 👍 or 👎

@martenson
Copy link
Member

Can this not occur in other contexts? Why only sequence and tabular?

@martenson martenson added this to the 24.2 milestone Jul 5, 2024
@mvdbeek
Copy link
Member Author

mvdbeek commented Jul 5, 2024

For other mako files we open in binary mode and let unicodify handle non-text content. It doesn't matter too much in the end, as long as it's not just a white screen. I hope we're going to replace this with client-side code sooner or later.

@bgruening bgruening merged commit 0beacf5 into galaxyproject:dev Jul 6, 2024
52 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants