diff options
author | Unknwon <u@gogs.io> | 2017-06-06 16:06:28 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-06-06 16:06:28 -0400 |
commit | c210984b40a23f20bebe1f905ff6b1297c3ad901 (patch) | |
tree | 247379719002f0aed9d0810f342c89b98b3d2aab /templates/repo | |
parent | 455dc072ba85c90c09e25867017216bacc506c8d (diff) |
repo: improve relative path detection (#4366)
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/view_file.tmpl | 3 |
1 files changed, 2 insertions, 1 deletions
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 `<img src="${context}/${href}"` } |