-
-
Notifications
You must be signed in to change notification settings - Fork 18
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 image transforms options #149
Conversation
Add download option to get_public_url
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
==========================================
- Coverage 85.38% 84.70% -0.69%
==========================================
Files 12 12
Lines 431 451 +20
==========================================
+ Hits 368 382 +14
- Misses 63 69 +6
☔ View full report in Codecov by Sentry. |
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?
Yeah I will update the reference docs for all these. |
_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}" |
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?
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.