community/py3-opencontainers: fix URL slash regex bug

This commit is contained in:
Antoine Martin 2024-09-18 15:31:46 -04:00 committed by Patrycja Rosa
parent 581adf6cb6
commit e7868eac11
3 changed files with 87 additions and 2 deletions

View file

@ -0,0 +1,58 @@
From e9fbaa47335dadf632a12a319747099435601608 Mon Sep 17 00:00:00 2001
From: Brenton <euclid@Euclid.local>
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 <brenton@mallen.us>
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",

View file

@ -0,0 +1,21 @@
From 3c5e4dbeaea744fd52515c3daba0e28741cb2091 Mon Sep 17 00:00:00 2001
From: "Jens L." <jens@beryju.org>
Date: Mon, 5 Aug 2024 13:50:13 +0200
Subject: [PATCH] Use raw python string for 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 d7aa151..6942e4e 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]))+"
+ r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
)
VALID_METHODS = ["HEAD", "GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS"]

View file

@ -3,7 +3,7 @@
pkgname=py3-opencontainers
_pyname=opencontainers
pkgver=0.0.14
pkgrel=1
pkgrel=2
arch="noarch"
pkgdesc="Python module for oci specifications"
url="https://pypi.python.org/project/opencontainers"
@ -19,7 +19,11 @@ makedepends="
checkdepends="
py3-pytest
"
source="$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/o/opencontainers/opencontainers-$pkgver.tar.gz"
source="
$pkgname-$pkgver.tar.gz::https://pypi.io/packages/source/o/opencontainers/opencontainers-$pkgver.tar.gz
20_escape-url-slash-regex.patch
21_use-raw-python-string-for-regex.patch
"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"
@ -40,4 +44,6 @@ package() {
sha512sums="
b0f0edb8d11c825e7bd64b0c38fb227823de0065dc35703cc930e5ad3a5c875abe5a8c8e16f34331ca2246f48887d34ab9749ca3b547216e0ece1aa7659dc845 py3-opencontainers-0.0.14.tar.gz
b81581cf9d19754a28fc8f30a200e34dc598c7c60ad8e908ff8574b0ccd5419ec21b684bc96adb007e1620c9b26f9dea988f3cb2edc49012d44ba62060d5696a 20_escape-url-slash-regex.patch
b1e53b2ef36d94e06835d80b372b884e10cc42fd478aa9a2ad20953744c068ff77922358f2522d21f0474974a48b5e4a5851a8c8b8482e337cbbdd2a0ae97b48 21_use-raw-python-string-for-regex.patch
"