1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Do not show non-image attachment in a <img> tag. Fixes #3215 (#3311)

This commit is contained in:
Andrey Nering
2016-08-11 20:16:36 -03:00
committed by 无闻
parent 7eafe3213f
commit 25b23c4bc9
4 changed files with 29 additions and 2 deletions

View File

@@ -41,7 +41,13 @@
<div class="ui bottom attached segment">
<div class="ui small images">
{{range .Issue.Attachments}}
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"><img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}"></a>
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}">
{{if FilenameIsImage .Name}}
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
{{else}}
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
{{end}}
</a>
{{end}}
</div>
</div>
@@ -96,7 +102,13 @@
<div class="ui bottom attached segment">
<div class="ui small images">
{{range .Attachments}}
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}"><img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}"></a>
<a target="_blank" href="{{AppSubUrl}}/attachments/{{.UUID}}">
{{if FilenameIsImage .Name}}
<img class="ui image" src="{{AppSubUrl}}/attachments/{{.UUID}}" title='{{$.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
{{else}}
<span class="ui image octicon octicon-desktop-download" title='{{$.i18n.Tr "repo.issues.attachment.download" .Name}}'></span>
{{end}}
</a>
{{end}}
</div>
</div>