Embedded Plugin - links to pdf's getting shown inline
I'm currently using 0.8.7 redmine and the embedded plugin. The doxygen I've got generated shows fine except for the pdf's, which get shown as gobbledegook inline.
Now, I tracked down some info about mime types, seems 0.8.7 was missing pdf's, so I added alot of that info in redmine's various files (http://www.redmine.org/issues/3782 and http://www.redmine.org/projects/redmine/repository/revisions/3286), but still getting the same problem.
Guessing it could be to do with this code in embedded's controller scripts (redmine/vendor/plugins/embedded/app/controllers/embedded_controller.rb):
if Redmine::MimeType.is_type?('image', path) send_file path, :disposition => 'inline', :type => Redmine::MimeType.of(path) else embed_file path end
I'm not really sure how to hack this so it can deal with pdf's appropriately (or even other files for that matter). Any ideas?
Also, how do you get debug messages sent to production.log? Can't find any information on that anywhere.
RE: Embedded Plugin - links to pdf's getting shown inline - Added by Matthias Geier about 7 years ago
I've got the same problem.
I'm not a Ruby programmer but I guess the solution should be quite simple.
According to http://www.redmine.org/projects/redmine/repository/entry/trunk/lib/redmine/mime_type.rb, there are three groups of MIME types: text, image and application.
The problem with the current version is that only images are sent directly to the client, everything else (including "application/pdf") is embedded into an HTML page.
I guess the solution would be something like this:
if !Redmine::MimeType.is_type?('text', path) send_file path, :disposition => 'inline', :type => Redmine::MimeType.of(path) else embed_file path end
This only changes the check for "image" to a check for "not text".
Can someone please create a bug report for this?
While it's been quite some time, I can confirm the solution suggested by Matthias seems to work on first look (tested with Reuben Mallabys version 0.0.2 of the plugin). Thanks!