diff --git a/rhodecode/lib/middleware/simplegit.py b/rhodecode/lib/middleware/simplegit.py --- a/rhodecode/lib/middleware/simplegit.py +++ b/rhodecode/lib/middleware/simplegit.py @@ -115,6 +115,10 @@ class SimpleGit(BaseVCSController): except: return HTTPInternalServerError()(environ, start_response) + # quick check if that dir exists... + if is_valid_repo(repo_name, self.basepath) is False: + return HTTPNotFound()(environ, start_response) + #====================================================================== # GET ACTION PULL or PUSH #====================================================================== @@ -181,10 +185,6 @@ class SimpleGit(BaseVCSController): repo_path = os.path.join(safe_str(self.basepath), safe_str(repo_name)) log.debug('Repository path is %s' % repo_path) - # quick check if that dir exists... - if is_valid_repo(repo_name, self.basepath) is False: - return HTTPNotFound()(environ, start_response) - try: #invalidate cache on push if action == 'push': diff --git a/rhodecode/lib/middleware/simplehg.py b/rhodecode/lib/middleware/simplehg.py --- a/rhodecode/lib/middleware/simplehg.py +++ b/rhodecode/lib/middleware/simplehg.py @@ -85,6 +85,10 @@ class SimpleHg(BaseVCSController): except: return HTTPInternalServerError()(environ, start_response) + # quick check if that dir exists... + if is_valid_repo(repo_name, self.basepath) is False: + return HTTPNotFound()(environ, start_response) + #====================================================================== # GET ACTION PULL or PUSH #====================================================================== @@ -163,10 +167,6 @@ class SimpleHg(BaseVCSController): baseui = make_ui('db') self.__inject_extras(repo_path, baseui, extras) - # quick check if that dir exists... - if is_valid_repo(repo_name, self.basepath) is False: - return HTTPNotFound()(environ, start_response) - try: # invalidate cache on push if action == 'push':