# images are sent inline
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
- :disposition => (@attachment.image? ? 'inline' : 'attachment')
+ :disposition => disposition(@attachment)
end
end
end
content_type.to_s
end
+
+ def disposition(attachment)
+ if attachment.is_image? || attachment.is_pdf?
+ 'inline'
+ else
+ 'attachment'
+ end
+ end
end
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path)
send_opt[:type] = send_type.to_s if send_type
- send_opt[:disposition] = (Redmine::MimeType.is_type?('image', @path) ? 'inline' : 'attachment')
+ send_opt[:disposition] = disposition(@path)
send_data @repository.cat(@path, @rev), send_opt
else
if !@entry.size || @entry.size <= Setting.file_max_size_displayed.to_i.kilobyte
)
graph.burn
end
+
+ def disposition(path)
+ if Redmine::MimeType.is_type?('image', @path) || Redmine::MimeType.of(@path) == "application/pdf"
+ 'inline'
+ else
+ 'attachment'
+ end
+ end
end