Fix handling of repository names that match known endpoints (build, trigger, etc) and add tests to ensure it is fixed

This commit is contained in:
Joseph Schorr 2014-03-11 14:30:00 -04:00
parent cbd8cf3bb5
commit e699739b23
3 changed files with 69 additions and 57 deletions

View file

@ -12,13 +12,20 @@ from data import model
from data.queue import dockerfile_build_queue
from app import app, login_manager
from auth.permissions import QuayDeferredPermissionUser
from werkzeug.routing import BaseConverter
logger = logging.getLogger(__name__)
route_data = None
class RepoPathConverter(BaseConverter):
regex = '[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+'
weight = 200
app.url_map.converters['repopath'] = RepoPathConverter
def get_route_data():
global route_data
if route_data:
@ -160,4 +167,4 @@ def start_build(repository, dockerfile_id, tags, build_name, subdir, manual,
ip=request.remote_addr, metadata=metadata,
repository=repository)
return build_request
return build_request