fix: correct repo/attatchment absolute url and release layout (#39178)

This commit is contained in:
wxiaoguang
2026-08-31 23:31:17 +00:00
committed by GitHub
parent fc9800b383
commit 4875bb3b2b
21 changed files with 72 additions and 80 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
{{$attachments := index $.Page.issuesAttachmentMap .ID}}
{{if $attachments}}
<div class="card-attachment-images">
{{range $attachments}}
<img loading="lazy" src="{{.DownloadURL}}" alt="{{.Name}}" />
{{range $att := $attachments}}
<img loading="lazy" src="{{$att.DownloadURL ctx}}" alt="{{$att.Name}}" />
{{end}}
</div>
{{end}}
@@ -3,23 +3,23 @@
<div class="divider"></div>
{{end}}
{{$hasThumbnails := false}}
{{- range .Attachments -}}
{{- range $att := .Attachments -}}
<div class="tw-flex">
<div class="tw-flex-1 tw-p-2">
<a target="_blank" href="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
{{if FilenameIsImage .Name}}
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
<a target="_blank" href="{{$att.DownloadURL ctx}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" $att.Name}}">
{{if FilenameIsImage $att.Name}}
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) $att.UUID)}}
{{$hasThumbnails = true}}
{{end}}
{{svg "octicon-file"}}
{{else}}
{{svg "octicon-desktop-download"}}
{{end}}
<span><strong>{{.Name}}</strong></span>
<span><strong>{{$att.Name}}</strong></span>
</a>
</div>
<div class="flex-text-block tw-p-2">
<span class="ui tw-text-text-light">{{.Size | FormatByteSize}}</span>
<span class="ui tw-text-text-light">{{$att.Size | FormatByteSize}}</span>
</div>
</div>
{{end -}}
@@ -30,8 +30,8 @@
{{- range .Attachments -}}
{{if FilenameIsImage .Name}}
{{if not (StringUtils.Contains (StringUtils.ToString $.RenderedContent) .UUID)}}
<a target="_blank" href="{{.DownloadURL}}">
<img loading="lazy" alt="{{.Name}}" src="{{.DownloadURL}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
<a target="_blank" href="{{.DownloadURL ctx}}">
<img loading="lazy" alt="{{.Name}}" src="{{.DownloadURL ctx}}" title="{{ctx.Locale.Tr "repo.issues.attachment.open_tab" .Name}}">
</a>
{{end}}
{{end}}
+1 -1
View File
@@ -80,7 +80,7 @@
<ul class="ui divided list attachment-list">
{{range $att := $release.Attachments}}
<li class="item">
<a target="_blank" class="tw-flex-1 gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL}}">
<a target="_blank" class="tw-flex-1 gt-ellipsis" rel="nofollow" download href="{{$att.DownloadURL ctx}}">
<strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong>
</a>
<div class="attachment-right-info flex-text-inline">
+9 -9
View File
@@ -2,15 +2,14 @@
{{$canReadCode := $.Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
{{if $canReadReleases}}
<div class="flex-text-block">
<div class="tw-flex-1 tw-flex tw-items-center">
<h2 class="ui compact small menu small-menu-items">
<a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.PrettyNumber .NumReleases}} {{ctx.Locale.TrN .NumReleases "repo.release" "repo.releases"}}</a>
{{if $canReadCode}}
<a class="{{if or .PageIsTagList .PageIsSingleTag}}active {{end}}item" href="{{.RepoLink}}/tags">{{ctx.Locale.PrettyNumber .NumTags}} {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
{{end}}
</h2>
</div>
<div class="flex-left-right">
<h2 class="ui compact small menu small-menu-items">
<a class="{{if and .PageIsReleaseList (not .PageIsSingleTag)}}active {{end}}item" href="{{.RepoLink}}/releases">{{ctx.Locale.PrettyNumber .NumReleases}} {{ctx.Locale.TrN .NumReleases "repo.release" "repo.releases"}}</a>
{{if $canReadCode}}
<a class="{{if or .PageIsTagList .PageIsSingleTag}}active {{end}}item" href="{{.RepoLink}}/tags">{{ctx.Locale.PrettyNumber .NumTags}} {{ctx.Locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
{{end}}
</h2>
<div class="flex-text-block">
{{if .EnableFeed}}
<a class="ui small button" href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss">
{{svg "octicon-rss" 16}} {{ctx.Locale.Tr "rss_feed"}}
@@ -21,6 +20,7 @@
{{ctx.Locale.Tr "repo.release.new_release"}}
</a>
{{end}}
</div>
</div>
<div class="divider"></div>
{{else if $canReadCode}}