changeset 7202:48f7c2aed3b7

git: fix links to nodes that are submodule links Without this changeset, a link pointing to ./<submodulename> would generate a '500 Internal Server Error'. Instead, redirect requests to submodule paths to the target URL.
author domruf <dominikruf@gmail.com>
date Sun, 11 Mar 2018 17:36:38 +0100
parents a8d8100f14e5
children 43c9da9eed11
files kallithea/controllers/files.py kallithea/tests/other/test_vcs_operations.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/files.py	Mon Nov 20 23:18:38 2017 +0100
+++ b/kallithea/controllers/files.py	Sun Mar 11 17:36:38 2018 +0100
@@ -165,7 +165,9 @@
         try:
             c.file = c.changeset.get_node(f_path)
 
-            if c.file.is_file():
+            if c.file.is_submodule():
+                raise HTTPFound(location=c.file.url)
+            elif c.file.is_file():
                 c.load_full_history = False
                 # determine if we're on branch head
                 _branches = c.db_repo_scm_instance.branches
--- a/kallithea/tests/other/test_vcs_operations.py	Mon Nov 20 23:18:38 2017 +0100
+++ b/kallithea/tests/other/test_vcs_operations.py	Sun Mar 11 17:36:38 2018 +0100
@@ -695,4 +695,5 @@
                                     repo_name=fork_name,
                                     revision='tip',
                                     f_path='/testsubmodule'),
-                                status=500) # BUG
+                                status=302)
+        assert response.location == clone_url