# HG changeset patch # User Mads Kiilerich # Date 1561892615 -7200 # Node ID fd03ac0708cf53d33d0e3978979055ccad80d981 # Parent 6a120c401d2529d5ce59bf368d93e3b93160d5e6 files: keep _repo_files_url as "global" const variable diff -r 6a120c401d25 -r fd03ac0708cf kallithea/templates/files/files.html --- a/kallithea/templates/files/files.html Sun Jun 23 00:43:44 2019 +0200 +++ b/kallithea/templates/files/files.html Sun Jun 30 13:03:35 2019 +0200 @@ -40,6 +40,7 @@ var CACHE = {}; var CACHE_EXPIRE = 5*60*1000; //cache for 5*60s //used to construct links from the search list +var _repo_files_url = ${h.jshtml(h.url("files_home",repo_name=c.repo_name,revision='',f_path='').replace('//', '/'))}; var url_base = ${h.js(h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__'))}; //send the nodelist request to this url var node_list_url = ${h.js(h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__'))}; @@ -60,11 +61,8 @@ var el = e.currentTarget; var url = el.href; - var _base_url = ${h.jshtml(h.url("files_home",repo_name=c.repo_name,revision='',f_path=''))}; - _base_url = _base_url.replace('//','/'); - //extract rev and the f_path from url. - parts = url.split(_base_url); + parts = url.split(_repo_files_url); if(parts.length != 2){ return false; } diff -r 6a120c401d25 -r fd03ac0708cf kallithea/tests/other/test_vcs_operations.py --- a/kallithea/tests/other/test_vcs_operations.py Sun Jun 23 00:43:44 2019 +0200 +++ b/kallithea/tests/other/test_vcs_operations.py Sun Jun 30 13:03:35 2019 +0200 @@ -563,6 +563,9 @@ repo_name=testfork['git'], revision='tip', f_path='/')) + # check _repo_files_url that will be used to reload as AJAX + response.mustcontain('var _repo_files_url = ("/%s/files/");' % testfork['git']) + response.mustcontain('testsubmodule @ ' % clone_url) # check that following a submodule link actually works - and redirects