File tree 2 files changed +15
-3
lines changed
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
11
11
"os"
12
12
"path"
13
13
14
+ "code.gitea.io/gitea/modules/log"
14
15
"code.gitea.io/gitea/modules/setting"
15
16
"code.gitea.io/gitea/modules/util"
16
17
api "code.gitea.io/sdk/gitea"
@@ -75,6 +76,16 @@ func (a *Attachment) Size() (int64, error) {
75
76
return fi .Size (), nil
76
77
}
77
78
79
+ // MustSize returns the result of a.Size() by ignoring errors
80
+ func (a * Attachment ) MustSize () int64 {
81
+ size , err := a .Size ()
82
+ if err != nil {
83
+ log .Error (4 , "size: %v" , err )
84
+ return 0
85
+ }
86
+ return size
87
+ }
88
+
78
89
// DownloadURL returns the download url of the attached file
79
90
func (a * Attachment ) DownloadURL () string {
80
91
return fmt .Sprintf ("%sattachments/%s" , setting .AppURL , a .UUID )
Original file line number Diff line number Diff line change 68
68
<ul class="list">
69
69
{{if $.Repository.UnitEnabled $.UnitTypeCode}}
70
70
<li>
71
- <a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</a>
71
+ <a href="{{$.RepoLink}}/archive/{{.TagName}}.zip" rel="nofollow"><strong>< i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (ZIP)</strong> </a>
72
72
</li>
73
73
<li>
74
- <a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</a>
74
+ <a href="{{$.RepoLink}}/archive/{{.TagName}}.tar.gz"><strong>< i class="octicon octicon-file-zip"></i> {{$.i18n.Tr "repo.release.source_code"}} (TAR.GZ)</strong> </a>
75
75
</li>
76
76
{{end}}
77
77
{{if .Attachments}}
78
78
{{range .Attachments}}
79
79
<li>
80
80
<a target="_blank" rel="noopener" href="{{AppSubUrl}}/attachments/{{.UUID}}">
81
- <span class="ui image octicon octicon-desktop-download" title='{{.Name}}'></span> {{.Name}}
81
+ <strong><span class="ui image octicon octicon-package" title='{{.Name}}'></span> {{.Name}}</strong>
82
+ <span class="ui text grey right">{{.MustSize | FileSize}}</span>
82
83
</a>
83
84
</li>
84
85
{{end}}
You can’t perform that action at this time.
0 commit comments