From c210984b40a23f20bebe1f905ff6b1297c3ad901 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 6 Jun 2017 16:06:28 -0400 Subject: repo: improve relative path detection (#4366) --- templates/repo/view_file.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'templates/repo') diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index 08f6d563..a093787e 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -53,7 +53,8 @@ // Overwrite image method to append proper prefix to the source URL var renderer = new marked.Renderer(); - var context = '{{.BranchLink}}'.replace('/src/', '/raw/'); + var context = '{{.RawFileLink}}'; + context = context.substring(0, context.lastIndexOf("/")); renderer.image = function (href, title, text) { return `