diff --git a/templates/repo/editor/diff_preview.tmpl b/templates/repo/editor/diff_preview.tmpl
index 06b4a2e830c..b663e4e93d5 100644
--- a/templates/repo/editor/diff_preview.tmpl
+++ b/templates/repo/editor/diff_preview.tmpl
@@ -3,9 +3,7 @@
- {{with .File}}
- {{template "repo/diff/section_unified" .}}
- {{end}}
+ {{template "repo/diff/section_unified" dict "file" .File "root" $}}
diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl
index b08838cac88..82656d65575 100644
--- a/templates/repo/editor/edit.tmpl
+++ b/templates/repo/editor/edit.tmpl
@@ -30,7 +30,7 @@