]> source.dussan.org Git - gitea.git/commitdiff
FIX download diff/patch from commit (#8792)
author6543 <24977596+6543@users.noreply.github.com>
Sat, 2 Nov 2019 22:47:25 +0000 (23:47 +0100)
committertechknowlogick <techknowlogick@gitea.io>
Sat, 2 Nov 2019 22:47:25 +0000 (18:47 -0400)
* send fix

* restart CI

* us Commit only when available

* CI.redo()

* more specific if statement

Co-Authored-By: mrsdizzie <info@mrsdizzie.com>
templates/repo/diff/options_dropdown.tmpl

index 9fca069f0a42935beeec9084148c84bd6fcfca6b..4bc6a3b9943464d0e7b3187a88b886fd3a480735 100644 (file)
@@ -3,7 +3,12 @@
        <i class="dropdown icon"></i>
        <div class="menu">
                <a class="item tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
-               <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
-               <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+               {{if .Issue.Index}}
+                       <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
+                       <a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+               {{else if .Commit.ID.String}}
+                       <a class="item" href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}.patch" download="{{ShortSha .Commit.ID.String}}.patch">{{.i18n.Tr "repo.diff.download_patch"}}</a>
+                       <a class="item" href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}.diff" download="{{ShortSha .Commit.ID.String}}.diff">{{.i18n.Tr "repo.diff.download_diff"}}</a>
+               {{end}}
        </div>
 </div>