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

Preserve encoding of stored reports #10762

Merged
merged 1 commit into from
May 3, 2023

Conversation

mkllnk
Copy link
Member

@mkllnk mkllnk commented Apr 28, 2023

What? Why?

Active Storage reads stored strings as ASCII and that can clash with Rails' default UTF-8 encoding when special characters are present.

What should we test?

  • Find a staging server that fails with master, e.g. au-staging
  • Activate background reports.
  • Render an On Screen report.
  • It should display as normal.

Release notes

Changelog Category: Technical changes

The title of the pull request will be included in the release notes.

Dependencies

Documentation updates

Active Storage reads stored strings as ASCII and that can clash with
Rails' default UTF-8 encoding when special characters are present.
@mkllnk mkllnk self-assigned this Apr 28, 2023
@mkllnk mkllnk marked this pull request as ready for review April 28, 2023 06:42
Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@dacook dacook self-requested a review May 2, 2023 00:23
Copy link
Member

@dacook dacook left a comment

Choose a reason for hiding this comment

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

Well done!

@drummer83 drummer83 self-assigned this May 3, 2023
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label May 3, 2023
@drummer83
Copy link
Contributor

Hi @mkllnk,

Thanks for this one. I tested this on staging AU. The data has some ä, ö, ü which may be critical for this PR.

I tested this using the following settings:

  • Running Order Cycle Supplier Total
  • as super admin user
  • with no date restrictions

Before staging

Background Reports active: Error 500 (after 17 s) ❌
Bugsnag link

ActionView::Template::Error admin/reports#show 
incompatible character encodings: UTF-8 and ASCII-8BIT

Background Reports not active: OK (after 17 s) ✔️

After staging

Background Reports active: OK (after 18 s) ✔️

Background Reports not active: OK (after 16 s) ✔️

Conclusion

This seems to solve the UTF vs. ASCII error. I didn't test more reports but I think we are safe because we still have the feature toggle.

Thanks again! Merging! 🚀

@drummer83 drummer83 merged commit 4b6ef77 into openfoodfoundation:master May 3, 2023
@drummer83 drummer83 removed the pr-staged-au staging.openfoodnetwork.org.au label May 3, 2023
@mkllnk mkllnk deleted the report-encoding branch July 28, 2023 04:54
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

Successfully merging this pull request may close these issues.

[background_reports] ActionView::Template::Error in admin/reports#show
4 participants