##// END OF EJS Templates
routing: detect invalid repo/group names before we hit DB checks to prevent some errors for bad repo names
super-admin -
r4841:bbd9cbf6 default
parent child Browse files
Show More
@@ -26,6 +26,7 b' from pyramid import compat'
26 26 from pyramid.httpexceptions import HTTPFound, HTTPForbidden, HTTPBadRequest
27 27
28 28 from rhodecode.lib import helpers as h, diffs, rc_cache
29 from rhodecode.lib.utils import repo_name_slug
29 30 from rhodecode.lib.utils2 import (
30 31 StrictAttributeDict, str2bool, safe_int, datetime_to_time, safe_unicode)
31 32 from rhodecode.lib.markup_renderer import MarkupRenderer, relative_links
@@ -617,6 +618,10 b' class RepoRoutePredicate(object):'
617 618 return
618 619
619 620 repo_name = info['match']['repo_name']
621 if repo_name != repo_name_slug(repo_name):
622 # short-skip if the repo-name doesn't follow slug rule
623 return False
624
620 625 repo_model = repo.RepoModel()
621 626
622 627 by_name_match = repo_model.get_by_repo_name(repo_name, cache=False)
@@ -722,6 +727,9 b' class RepoGroupRoutePredicate(object):'
722 727 return
723 728
724 729 repo_group_name = info['match']['repo_group_name']
730 if repo_group_name != repo_name_slug(repo_group_name):
731 return False
732
725 733 repo_group_model = repo_group.RepoGroupModel()
726 734 by_name_match = repo_group_model.get_by_group_name(repo_group_name, cache=False)
727 735
General Comments 0
You need to be logged in to leave comments. Login now