From e9fbaa47335dadf632a12a319747099435601608 Mon Sep 17 00:00:00 2001 From: Brenton Date: Wed, 8 May 2024 22:51:06 -0400 Subject: [PATCH 1/2] Escape url slash regex --- opencontainers/distribution/reggie/defaults.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opencontainers/distribution/reggie/defaults.py b/opencontainers/distribution/reggie/defaults.py index 8b43fb9..d7aa151 100644 --- a/opencontainers/distribution/reggie/defaults.py +++ b/opencontainers/distribution/reggie/defaults.py @@ -14,6 +14,6 @@ __version__ ) URL_REGEX = ( - "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" + "http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" ) VALID_METHODS = ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"] From 88b21cd03156c8b81717bfe61f46a22e68f88508 Mon Sep 17 00:00:00 2001 From: Brenton Date: Thu, 9 May 2024 00:37:57 -0400 Subject: [PATCH 2/2] format tests --- opencontainers/tests/test_descriptor.py | 2 +- opencontainers/tests/test_manifest.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opencontainers/tests/test_descriptor.py b/opencontainers/tests/test_descriptor.py index ebb0512..07b3a1b 100644 --- a/opencontainers/tests/test_descriptor.py +++ b/opencontainers/tests/test_descriptor.py @@ -137,7 +137,7 @@ { "mediaType": "application/vnd.oci.image.config.v1+json", "size": 1470, - "digest": "sha256.foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b" + "digest": "sha256.foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b", # multihash example removed, not supported is invalid }, ] diff --git a/opencontainers/tests/test_manifest.py b/opencontainers/tests/test_manifest.py index 6fc7b84..2aec60b 100644 --- a/opencontainers/tests/test_manifest.py +++ b/opencontainers/tests/test_manifest.py @@ -140,7 +140,7 @@ "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip", "size": 1470, "digest": "sha256.foo-bar:c86f7763873b6c0aae22d963bab59b4f5debbed6685761b5951584f6efb0633b", - } + }, # multihash is not registered, but still valid formatting, but here we would consider it invalid # { # "mediaType": "application/vnd.oci.image.config.v1+json",