# HG changeset patch # User Marcin Kuzminski # Date 2019-06-03 08:47:37 # Node ID 67fe05b8cf8b9d8fc4116059869651ad11a87b6d # Parent 0edc69aa0f0fd2c63583dc1c1a76dca1fc16842b files: fixed case of partial url in generating files metadata diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -272,6 +272,18 @@ def files_breadcrumbs(repo_name, commit_ return literal(' / '.join(url_segments) + icon) +def files_url_data(request): + matchdict = request.matchdict + + if 'f_path' not in matchdict: + matchdict['f_path'] = '' + + if 'commit_id' not in matchdict: + matchdict['commit_id'] = 'tip' + + return json.dumps(matchdict) + + def code_highlight(code, lexer, formatter, use_hl_filter=False): """ Lex ``code`` with ``lexer`` and format it with the formatter ``formatter``. diff --git a/rhodecode/templates/files/files.mako b/rhodecode/templates/files/files.mako --- a/rhodecode/templates/files/files.mako +++ b/rhodecode/templates/files/files.mako @@ -35,7 +35,7 @@ metadataRequest = null; // global metadata about URL - filesUrlData = ${h.json.dumps(request.matchdict)|n}; + filesUrlData = ${h.files_url_data(request)|n};