Skip to content

Commit 04105db

Browse files
authored
Fix download archiver of a commit (#20962) (#20971)
1 parent 0a0cd75 commit 04105db

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/context/repo.go

+1
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ func RepoRefByType(refType RepoRefType, ignoreNotExistErr ...bool) func(*Context
986986
}
987987

988988
ctx.Data["BranchName"] = ctx.Repo.BranchName
989+
ctx.Data["RefName"] = ctx.Repo.RefName
989990
ctx.Data["BranchNameSubURL"] = ctx.Repo.BranchNameSubURL()
990991
ctx.Data["TagName"] = ctx.Repo.TagName
991992
ctx.Data["CommitID"] = ctx.Repo.CommitID

templates/repo/home.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@
122122
{{svg "octicon-download"}}
123123
<div class="menu">
124124
{{if not $.DisableDownloadSourceArchives}}
125-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.BranchName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.i18n.Tr "repo.download_zip"}}</a>
126-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.BranchName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.i18n.Tr "repo.download_tar"}}</a>
127-
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.BranchName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "mr-3"}}{{.i18n.Tr "repo.download_bundle"}}</a>
125+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.i18n.Tr "repo.download_zip"}}</a>
126+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.i18n.Tr "repo.download_tar"}}</a>
127+
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "mr-3"}}{{.i18n.Tr "repo.download_bundle"}}</a>
128128
{{end}}
129129
<a class="item" href="vscode://vscode.git/clone?url={{$.RepoCloneLink.HTTPS}}">{{svg "gitea-vscode" 16 "mr-3"}}{{.i18n.Tr "repo.clone_in_vsc"}}</a>
130130
</div>

0 commit comments

Comments
 (0)