incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [15/50] [abbrv] git commit: [#6056] Fixed KeyError when browsing invalid trees in SCM
Date Thu, 11 Jul 2013 21:58:35 GMT
[#6056] Fixed KeyError when browsing invalid trees in SCM

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/96df73a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/96df73a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/96df73a1

Branch: refs/heads/db/6277
Commit: 96df73a1789843cb8dbdffcec050beaa985cb71b
Parents: 8e1581e
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Mon Jul 1 21:49:25 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Sun Jul 7 03:48:41 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py                | 5 +++--
 ForgeGit/forgegit/tests/functional/test_controllers.py | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/96df73a1/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 4f6122d..c8d852b 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -548,8 +548,9 @@ class TreeBrowser(BaseController, DispatchIndex):
                         filename), rest
         elif rest == ('index', ):
             rest = (request.environ['PATH_INFO'].rsplit('/')[-1],)
-        tree = self._tree[next]
-        if tree is None:
+        try:
+            tree = self._tree[next]
+        except KeyError:
             raise exc.HTTPNotFound
         return self.__class__(
             self._commit,

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/96df73a1/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index c4ac325..3304625 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -205,6 +205,13 @@ class TestRootController(_TestCase):
         resp = self.app.get(ci + 'tree/?format=raw')
         assert 'README' in resp, resp.showbrowser()
 
+    def test_tree_invalid(self):
+        ci = self._get_ci()
+        resp = self.app.get(ci + 'tree/foo', status=404)
+        assert_equal(resp.status_int, 404)
+        resp = self.app.get(ci + 'tree/foo/bar', status=404)
+        assert_equal(resp.status_int, 404)
+
     def test_file(self):
         ci = self._get_ci()
         resp = self.app.get(ci + 'tree/README')


Mime
View raw message