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

Adx 977 invalid filename allowed upon upload #277

Merged
merged 16 commits into from
Apr 25, 2023

Conversation

A-Souhei
Copy link
Contributor

@A-Souhei A-Souhei commented Apr 6, 2023

Description

Having a % in the filename causes a 400 bad request.
What I did: wrote an helper to encode the filename in the CKAN template
Added a short javascript code in the template to update the filename upon DomContentLoaded

Checklist

Put an x in the boxes that apply to this pull request (you can also fill these out after opening the pull request).
You may not need to check all boxes.

  • The Jira ticket for this issue has been updated to "Ready to Review" or equivalent.
  • I have developed these changes in discussion with the appropriate project manager.
  • My code follows the general Fjelltopp documentation (see Confluence).
  • I have made corresponding changes to the Fjelltopp documentation (see Confluence).
  • I have rebased this branch with master.
  • New dependency changes have been committed.
  • I have added automated tests that prove my fix is effective or that my feature works.
  • New and existing tests pass locally with my changes.
  • My changes generate no new warnings.
  • I have performed a self-review of my own code.
  • I have assigned at least one reviewer.

Copy link
Member

@tomeksabala tomeksabala left a comment

Choose a reason for hiding this comment

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

I think you can fully replace your url_encode implementation with the use of Python urllib quote function (still wrapped in form of template helper of course).

Also please add a regression test for the bug.

ckanext/unaids/helpers.py Outdated Show resolved Hide resolved
ckanext/unaids/tests/test_giftless_backend.py Outdated Show resolved Hide resolved
ckanext/unaids/tests/test_giftless_backend.py Outdated Show resolved Hide resolved
ckanext/unaids/tests/test_giftless_backend.py Outdated Show resolved Hide resolved
Copy link
Member

@tomeksabala tomeksabala left a comment

Choose a reason for hiding this comment

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

Please fix the linting (flake8) issues in the code.

tomeksabala
tomeksabala previously approved these changes Apr 24, 2023
@A-Souhei A-Souhei merged commit 7013085 into development Apr 25, 2023
3 of 4 checks passed
@A-Souhei A-Souhei deleted the ADX-977-invalid-filename-allowed-upon-upload branch April 25, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants