summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2016-08-11 20:16:36 -0300
committer无闻 <u@gogs.io>2016-08-11 16:16:36 -0700
commit25b23c4bc991644c7db47b484dca3bb2d2694e62 (patch)
treee73bc7c63cf91870df49cd2cb3c91c9e7ef152ea /templates
parent7eafe3213f456bb4fcbaeea5562ab60c4ef6cf87 (diff)
downloadgitea-25b23c4bc991644c7db47b484dca3bb2d2694e62.tar.gz
gitea-25b23c4bc991644c7db47b484dca3bb2d2694e62.zip
Do not show non-image attachment in a <img> tag. Fixes #3215 (#3311)
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/issue/view_content.tmpl16
1 files changed, 14 insertions, 2 deletions
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl
index d2183d4164..ebd737c381 100644
--- a/templates/repo/issue/view_content.tmpl
+++ b/templates/repo/issue/view_content.tmpl
@@ -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>