diff rhodecode/lib/middleware/simplegit.py @ 2122:c137b8a81f8e beta

git+hg middleware do repo verification at earliest possible state, giving 404 as fast as possible. If repo is not found.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 12 Mar 2012 20:33:13 +0200
parents 8ecfed1d8f8b
children 46b67235a8f0
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py	Mon Mar 12 20:21:52 2012 +0200
+++ b/rhodecode/lib/middleware/simplegit.py	Mon Mar 12 20:33:13 2012 +0200
@@ -115,6 +115,10 @@
         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 @@
         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':