From ccd7bff8a2f704329965861a8b39ed6a8012e744 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Wed, 5 Feb 2025 16:56:25 +0000 Subject: [PATCH 1/3] Add missing "signature" when no salt/key is used --- pyimgproxy/image.py | 2 +- tests/test_image.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyimgproxy/image.py b/pyimgproxy/image.py index 2cfa10d..aee76ec 100644 --- a/pyimgproxy/image.py +++ b/pyimgproxy/image.py @@ -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}" diff --git a/tests/test_image.py b/tests/test_image.py index cc60d89..8c88efa 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -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", ) From b9c997da82674809d82af0a092b30ad6e9fc14f9 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Wed, 5 Feb 2025 16:56:45 +0000 Subject: [PATCH 2/3] Remove additional rogue True --- pyimgproxy/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyimgproxy/image.py b/pyimgproxy/image.py index aee76ec..b35ca04 100644 --- a/pyimgproxy/image.py +++ b/pyimgproxy/image.py @@ -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, From 9e20ee4b42932eae7fe3077b8e3610eaf5884207 Mon Sep 17 00:00:00 2001 From: Alex Tomkins Date: Wed, 5 Feb 2025 16:56:53 +0000 Subject: [PATCH 3/3] Update copyright year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 6b55ca9..c7237a6 100644 --- a/LICENSE +++ b/LICENSE @@ -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