浏览代码

repo: improve relative path detection (#4366)

Unknwon 7 年之前
父节点
当前提交
c210984b40
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      templates/repo/view_file.tmpl

+ 2 - 1
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}"`
 						}