Improved content type detection for image preview of attachments.
This commit is contained in:
parent
5b24e7beaf
commit
3e50a06306
1 changed files with 5 additions and 4 deletions
|
@ -62,13 +62,14 @@
|
||||||
<div class="attachment-size"><%- @humanFileSize(attachment.size) %></div>
|
<div class="attachment-size"><%- @humanFileSize(attachment.size) %></div>
|
||||||
</div>
|
</div>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<a class="attachment attachment--preview" title="<%- attachment.preferences['Content-Type'] %>" target="_blank" href="<%= App.Config.get('api_path') %>/ticket_attachment/<%= @article.ticket_id %>/<%= @article.id %>/<%= attachment.id %>?disposition=attachment" data-type="attachment"<% if @canDownload(attachment.preferences['Content-Type']): %> download<% end %>>
|
<% content_type = attachment.preferences['Content-Type'] || attachment.preferences['content_type'] %>
|
||||||
|
<a class="attachment attachment--preview" title="<%- content_type %>" target="_blank" href="<%= App.Config.get('api_path') %>/ticket_attachment/<%= @article.ticket_id %>/<%= @article.id %>/<%= attachment.id %>?disposition=attachment" data-type="attachment"<% if @canDownload(content_type): %> download<% end %>>
|
||||||
<div class="attachment-icon">
|
<div class="attachment-icon">
|
||||||
<% if attachment.preferences && attachment.preferences['Content-Type'] && @ContentTypeIcon(attachment.preferences['Content-Type']): %>
|
<% if attachment.preferences && content_type && @ContentTypeIcon(content_type): %>
|
||||||
<% if @canPreview(attachment.preferences['Content-Type']): %>
|
<% if @canPreview(content_type): %>
|
||||||
<img src="<%= App.Config.get('api_path') %>/ticket_attachment/<%= @article.ticket_id %>/<%= @article.id %>/<%= attachment.id %>?view=preview">
|
<img src="<%= App.Config.get('api_path') %>/ticket_attachment/<%= @article.ticket_id %>/<%= @article.id %>/<%= attachment.id %>?view=preview">
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<%- @Icon( @ContentTypeIcon(attachment.preferences['Content-Type']) ) %>
|
<%- @Icon( @ContentTypeIcon(content_type) ) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<%- @Icon('file-unknown') %>
|
<%- @Icon('file-unknown') %>
|
||||||
|
|
Loading…
Reference in a new issue