Shrine Direct S3 Upload results in octet-stream mime-type #630
Replies: 2 comments 3 replies
-
The The I would recommend trying a different MIME type analyzer, see the docs for more details. |
Beta Was this translation helpful? Give feedback.
-
Thank @janko. We added this part to the uploader : plugin :metadata_attributes, filename: :name, size: :size, mime_type: :type
plugin :determine_mime_type, analyzer: :marcel, analyzer_options: { filename_fallback: true }
plugin :refresh_metadata It works as we now have the right mime_type. We've been struggling with this for days now. |
Beta Was this translation helpful? Give feedback.
-
After following this tutorial, we set up a Direct Upload using Shrine and Uppy on S3.
During our tests, a pdf file is well uploaded on S3 in the cache folder via a Drag&Drop box on our app. The problem is that when we assign it to our Doc model, two things happened:
mime_type
into account in itsfile_data
column, and instead, labels it asapplication/octet-stream
.Our setup seems to be ok, as it used to work just a month ago. Still, we cannot figure it out after many tries and ivestigations... Please note that our S3 CORS and ENV setup is ok, and that there do not seem to be any problems with authorizations/access.
shrine.rb
file_uploader.rb
upload_controller.js (Uppy part)
doc.rb
docs_controller.rb
The doc_controller
binding.pry
leads to thoseparams[:file]
:"{\"id\":\"dd5acef2cd5f7303309406308c849720.pdf\",\"storage\":\"cache\",\"metadata\":{\"size\":1180288,\"filename\":\"Demande + certificat.pdf\",\"mime_type\":\"application/pdf\"}}"
But once assigned to the Doc object we got octet-stream in
file_data
column:file_data: "{\"id\":\"dd5acef2cd5f7303309406308c849720.pdf\",\"storage\":\"cache\",\"metadata\":{\"size\":1180288,\"filename\":\"Demande + certificat.pdf\",\"mime_type\":\"application/octet-stream\"}}"
We are completly lost after trying all Shrine plugins, etc, etc...
Many thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions