fix: tag regex should allow ports

Closes: https://github.com/docker/docker-py/issues/3195
Related: https://github.com/opencontainers/distribution-spec/pull/498

Signed-off-by: Sven Kieske <kieske@osism.tech>
This commit is contained in:
Sven Kieske 2023-12-12 17:40:47 +01:00
parent 7d8a161b12
commit 007a95c2e3
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -10,8 +10,9 @@ from ..constants import IS_WINDOWS_PLATFORM
_SEP = re.compile('/|\\\\') if IS_WINDOWS_PLATFORM else re.compile('/')
_TAG = re.compile(
r"^[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*" \
+ "(:[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127})?$"
r"^[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*" \
+ "(?::[0-9]+)?(/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*" \
+ "(:[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127})?$"
)