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

Fix image transforms options #149

Merged
merged 3 commits into from
Sep 28, 2023

Conversation

silentworks
Copy link
Collaborator

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.

CHANGELOG.md Show resolved Hide resolved
storage3/_sync/file_api.py Outdated Show resolved Hide resolved
storage3/types.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (8dbd29a) 85.38% compared to head (f8f7482) 84.70%.
Report is 3 commits behind head on main.

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     
Files Coverage Δ
storage3/types.py 95.91% <100.00%> (+0.17%) ⬆️
storage3/_async/file_api.py 83.20% <78.57%> (-1.29%) ⬇️
storage3/_sync/file_api.py 83.20% <78.57%> (-1.29%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@J0 J0 left a 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?

@silentworks
Copy link
Collaborator Author

Yeah I will update the reference docs for all these.

@silentworks silentworks merged commit 64a8ab2 into main Sep 28, 2023
12 checks passed
@silentworks silentworks deleted the fix/correct-option-type-for-transforms branch September 28, 2023 09:37
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}"
Copy link
Contributor

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 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.

4 participants