From ab8162dcb17404bb0b5c6f8f30b19054791ee8f7 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Mon, 3 Jun 2019 10:47:37 +0200 Subject: [PATCH] files: fixed case of partial url in generating files metadata --- rhodecode/lib/helpers.py | 12 ++++++++++++ rhodecode/templates/files/files.mako | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py index 710a2bf4..510be96b 100644 --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -272,6 +272,18 @@ def files_breadcrumbs(repo_name, commit_id, file_path, at_ref=None, limit_items= 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 index ace574d9..25d6fd68 100644 --- 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};