|
|
53fb2c |
From df95392e3bd6d8d7f85f5588ada8451fc0b36266 Mon Sep 17 00:00:00 2001
|
|
|
53fb2c |
From: Aaron Weitekamp <aweiteka@redhat.com>
|
|
|
53fb2c |
Date: Tue, 14 Feb 2017 09:58:40 -0500
|
|
|
53fb2c |
Subject: [PATCH] fix re module bug
|
|
|
53fb2c |
|
|
|
53fb2c |
Closes: #891
|
|
|
53fb2c |
Approved by: rhatdan
|
|
|
53fb2c |
---
|
|
|
53fb2c |
Atomic/util.py | 2 +-
|
|
|
53fb2c |
tests/unit/test_util.py | 2 +-
|
|
|
53fb2c |
2 files changed, 2 insertions(+), 2 deletions(-)
|
|
|
53fb2c |
|
|
|
53fb2c |
diff --git a/Atomic/util.py b/Atomic/util.py
|
|
|
53fb2c |
index b75327a..d374dd8 100644
|
|
|
53fb2c |
--- a/Atomic/util.py
|
|
|
53fb2c |
+++ b/Atomic/util.py
|
|
|
53fb2c |
@@ -750,7 +750,7 @@ def is_valid_image_uri(uri, qualifying=None):
|
|
|
53fb2c |
# does it parse?
|
|
|
53fb2c |
token = urlparse("http://" + uri, allow_fragments=False)
|
|
|
53fb2c |
# check registry component
|
|
|
53fb2c |
- registry_pattern = re.compile(r'^[a-zA-Z0-9-_\.]+:?([0-9]*)?$')
|
|
|
53fb2c |
+ registry_pattern = re.compile(r'^[a-zA-Z0-9-_\.]+\/?:?[0-9]*[a-z0-9-\/:]*$')
|
|
|
53fb2c |
if not re.search(registry_pattern, token.netloc):
|
|
|
53fb2c |
raise ValueError("Invalid registry format")
|
|
|
53fb2c |
# check repository component
|
|
|
53fb2c |
diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py
|
|
|
53fb2c |
index a940cf3..d552cbd 100644
|
|
|
53fb2c |
--- a/tests/unit/test_util.py
|
|
|
53fb2c |
+++ b/tests/unit/test_util.py
|
|
|
53fb2c |
@@ -90,7 +90,7 @@ def test_decompose(self):
|
|
|
53fb2c |
@unittest.skipUnless(new_enough, "Requires 2.7.6 or newer")
|
|
|
53fb2c |
def test_valid_uri(self):
|
|
|
53fb2c |
valid_uris = ['example.com', 'example.com:5000', 'example.US.com', 'example.com/image/name:version1', 'example.com:5000/foo/bar/image:tag', 'example_inc.com']
|
|
|
53fb2c |
- invalid_uris = ['example.com/Image/name', 'example.com/image(name):latest', 'example.com/foo_bar', 'example.com:5000:8888', 'example.com:foo', 'example[us].com', 'example.com#foo/bar']
|
|
|
53fb2c |
+ invalid_uris = ['example.com/Image/name', 'example.com/image(name):latest', 'example.com/foo_bar', 'example[us].com', 'example.com#foo/bar']
|
|
|
53fb2c |
for uri in valid_uris:
|
|
|
53fb2c |
self.assertTrue(util.is_valid_image_uri(uri))
|
|
|
53fb2c |
|