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

Fix UnicodeDecodeError on Attachment upload #1846

Merged
merged 3 commits into from
Sep 17, 2021

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

This PR fixes a UnicodeDecodeError that happens when an attachment is assigned to an Analysis with a title containing unicode characters.

Traceback:

Traceback (innermost last):
  Module ZServer.ZPublisher.Publish, line 144, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZServer.ZPublisher.Publish, line 44, in call_object
  Module senaite.core.browser.attachment.attachment, line 91, in __call__
  Module senaite.core.browser.attachment.attachment, line 266, in action_add
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10: ordinal not in range(128)

Current behavior before PR

Traceback occurs when an attachment is uploaded in a sample/worksheet and assigned to an analysis with a title containing unicode characters.

Desired behavior after PR is merged

Upload works for all analysis titles.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argg, this is always a brain killer!

@xispa xispa merged commit 2291d6c into 2.x Sep 17, 2021
@xispa xispa deleted the fix-attachment-unicode-decode-error branch September 17, 2021 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants