This repository was archived by the owner on Sep 8, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 26
Fix image transforms options #149
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
anand2312
suggested changes
Sep 26, 2023
Add download option to get_public_url
This comment was marked as off-topic.
This comment was marked as off-topic.
J0
approved these changes
Sep 28, 2023
Contributor
J0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for putting this together! Could you please update the reference spec as well when a slot frees up?
Collaborator
Author
|
Yeah I will update the reference docs for all these. |
anand2312
reviewed
Sep 28, 2023
Comment on lines
+211
to
+234
| _query_string = [] | ||
| download_query = None | ||
| if options.get("download"): | ||
| download_query = ( | ||
| "download=" | ||
| if options.get("download") is True | ||
| else f"download={options.get('download')}" | ||
| ) | ||
|
|
||
| if download_query: | ||
| _query_string.append(download_query) | ||
|
|
||
| render_path = "render/image" if options.get("transform") else "object" | ||
| transformation_query = urllib.parse.urlencode(options) | ||
| query_string = f"?{transformation_query}" if transformation_query else "" | ||
| transformation_query = ( | ||
| urllib.parse.urlencode(options.get("transform")) | ||
| if options.get("transform") | ||
| else None | ||
| ) | ||
|
|
||
| if transformation_query: | ||
| _query_string.append(transformation_query) | ||
|
|
||
| query_string = "&".join(_query_string) | ||
| query_string = f"?{query_string}" |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little confused by this diff - why are we manually constructing the query string instead of letting urllib.parse.urlencode do the work?
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix to get image transforms working.
What is the current behavior?
Currently image transforms aren't being passed over correctly as we are checking for "transform" in the options property while we only have the direct transform properties there.
What is the new behavior?
Added the additional "transform" key to the dict hence allowing the transforms to work correctly.
Additional context
Add any other context or screenshots.