exfile icon indicating copy to clipboard operation
exfile copied to clipboard

When add file extension to filename, processing using convert failed with reason no_processor

Open loongmxbt opened this issue 8 years ago • 3 comments

<%= exfile_path(@paper.file, filename: "PID#{@paper.id}-CID#{@topic.id}") %>
# URI
http://localhost:4000/attachments/f_LMR2YRJf7VRSrYEuKSmIYP0SXDilBiesY7lbhJqWY=/store/d907666bb877f897119308dfaa65cb96a6f827f6e089cb498bf7290548da/PID1-CID1

works fine.

But when add .pdf or other file extensions

<%= exfile_path(@paper.file, filename: "PID#{@paper.id}-CID#{@topic.id}.pdf") %>
# URI
http://localhost:4000/attachments/TpZXUPYiDwdC5B3S75Ju9aF1pFPM3iby8sHGE6X_ngE=/store/d907666bb877f897119308dfaa65cb96a6f827f6e089cb498bf7290548da/PID1-CID1.pdf

It shows

processing using convert failed with reason no_processor

Any ideas how to add extension for download?

PS:

If I use format: "pdf", seems nothing changes.

Press CTRL+S the filename still have no extension like PID1-CID1
# URI
http://localhost:4000/attachments/f_LMR2YRJf7VRSrYEuKSmIYP0SXDilBiesY7lbhJqWY=/store/d907666bb877f897119308dfaa65cb96a6f827f6e089cb498bf7290548da/PID1-CID1

loongmxbt avatar Sep 29 '16 05:09 loongmxbt

Using exfile-imagemagick and imagemagick solves the "file rename problem".

loongmxbt avatar Oct 22 '16 08:10 loongmxbt

I have a similar issue.

I'm serving .pdf files and identify -format %w <file> commands takes too long to run, giving me GenServer Timeout error. (I'm using master branch of ExfileImagemagick)

I compared the source code of refile and exfile and noticed that refile skips the file conversion when there's no processor in the url. Conversely, exfile always tries to convert the file when format is present in the url.

@keichan34 what do you think about adding the whitelist of extensions that support format conversion?

It could process all of the formats by default to keep backwards compatibility.

scarfacedeb avatar Oct 30 '17 09:10 scarfacedeb

@keichan34 I've updated my fork of exfile to support whitelisted formats.

If you're interested, here's the relevant commit: https://github.com/scarfacedeb/exfile/commit/6d1b0d26136cf7d9786402b93230a32c3c245a2d

scarfacedeb avatar Oct 31 '17 14:10 scarfacedeb