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

Minor fixes #17

Merged
merged 3 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024, Developer Society Limited
Copyright (c) 2024-2025, Developer Society Limited
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 2 additions & 2 deletions pyimgproxy/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def url(self) -> str:
else:
image_path = f"/plain/{self._source_url}".encode()

if self.imgproxy.key and self.imgproxy.salt and True:
if self.imgproxy.key and self.imgproxy.salt:
unsigned_path = options_path_bytes + image_path
digest = hmac.new(
key=self.imgproxy.key,
Expand All @@ -747,6 +747,6 @@ def url(self) -> str:
full_path = (b"/" + signature + unsigned_path).decode()
else:
# No signature checking - the signature part may contain anything
full_path = (options_path_bytes + image_path).decode()
full_path = (b"/_" + options_path_bytes + image_path).decode()

return f"{self.imgproxy.url}{full_path}"
2 changes: 1 addition & 1 deletion tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,5 @@ def test_url_no_key_or_salt(self):

self.assertEqual(
image.url,
"https://example.org/thumbnail/size:640:480/plain/demo.png",
"https://example.org/thumbnail/_/size:640:480/plain/demo.png",
)