Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Enforce the same tag name rules as the docker client
Browse files Browse the repository at this point in the history
  • Loading branch information
shin- committed Feb 25, 2015
1 parent 1b3d221 commit 3edf929
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docker_registry/tags.py
Expand Up @@ -22,6 +22,7 @@
store = storage.load()
logger = logging.getLogger(__name__)
RE_USER_AGENT = re.compile('([^\s/]+)/([^\s/]+)')
RE_VALID_TAG = re.compile('^[\w][\w.-]{0,127}$')


@app.route('/v1/repositories/<path:repository>/properties', methods=['PUT'])
Expand Down Expand Up @@ -182,6 +183,10 @@ def create_tag_json(user_agent):
def put_tag(namespace, repository, tag):
logger.debug("[put_tag] namespace={0}; repository={1}; tag={2}".format(
namespace, repository, tag))
if not RE_VALID_TAG.match(tag):
return toolkit.api_error('Invalid tag name (must match {0})'.format(
RE_VALID_TAG.pattern
))
data = None
try:
# Note(dmp): unicode patch
Expand Down

0 comments on commit 3edf929

Please sign in to comment.