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

Let requests handle url encoding #610

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

nicogodet
Copy link
Contributor

Previously, if a plugin url was like "https://mypluginrepo.example.com/download.php?plugin=MyPlugin", it raises an error as "?" and "=" where encoded
Trace: 404 Client Error: Not Found for url: https://mypluginrepo.example.com/download.php%3Fplugin%3DMyPlugin
The issue is that quote() would encode the entire URL including the protocol and special characters that should remain unencoded (like ://?=). This would break the URL structure.

download_remote_file_to_local use requests. Let it handle the encoding part and provide instead the base url and query params.

@github-actions github-actions bot added the quality Tests, project resiliency, etc. label Jan 16, 2025
Copy link

Copy link
Collaborator

@Guts Guts left a comment

Choose a reason for hiding this comment

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

Not sure if it does not break or not any URL but it sounds good to let Requests doing its magic.

@Guts Guts merged commit e3593c5 into qgis-deployment:main Jan 16, 2025
23 checks passed
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #610      +/-   ##
==========================================
- Coverage   70.63%   70.04%   -0.59%     
==========================================
  Files          47       47              
  Lines        3204     3208       +4     
  Branches      566      566              
==========================================
- Hits         2263     2247      -16     
- Misses        740      755      +15     
- Partials      201      206       +5     
Flag Coverage Δ
unittests 69.48% <100.00%> (-0.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
qgis_deployment_toolbelt/plugins/plugin.py 78.41% <100.00%> (ø)
qgis_deployment_toolbelt/utils/file_downloader.py 75.38% <100.00%> (+1.61%) ⬆️

... and 2 files with indirect coverage changes

@Guts Guts added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working quality Tests, project resiliency, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants