# HG changeset patch # User domruf # Date 2018-03-11 17:36:38 # Node ID 48f7c2aed3b7fc6e7243c76cc73e03af1d41bd51 # Parent a8d8100f14e516a7b6b43ac4bc8973c8d9f06cd5 git: fix links to nodes that are submodule links Without this changeset, a link pointing to ./ would generate a '500 Internal Server Error'. Instead, redirect requests to submodule paths to the target URL. diff --git a/kallithea/controllers/files.py b/kallithea/controllers/files.py --- a/kallithea/controllers/files.py +++ b/kallithea/controllers/files.py @@ -165,7 +165,9 @@ class FilesController(BaseRepoController 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 diff --git a/kallithea/tests/other/test_vcs_operations.py b/kallithea/tests/other/test_vcs_operations.py --- a/kallithea/tests/other/test_vcs_operations.py +++ b/kallithea/tests/other/test_vcs_operations.py @@ -695,4 +695,5 @@ class TestVCSOperations(TestController): repo_name=fork_name, revision='tip', f_path='/testsubmodule'), - status=500) # BUG + status=302) + assert response.location == clone_url