shrine: mime_type cannot open: No such file or directory
I’m using determine_mime_type and it works fine most of time but some times, it gives error mime_type cannot open No such file or directory while same file can be uploaded after multiple tries. any idea what is causing this ?
{
"id": "f972ca5ea746dfc641f390757a3acb7b",
"storage": "cache",
"metadata": {
"filename": "Oman Integrated Residential Project.jpg",
"size": 111662,
"mime_type": "cannot open: No such file or directory",
"cloudinary": {
"public_id": "cache/c",
"version": 1540305195,
"signature": "c",
"resource_type": "raw",
"created_at": "2018-10-23T14:33:15Z",
"tags": [],
"bytes": 111662,
"type": "upload",
"etag": "c",
"placeholder": false,
"url": "http://res.cloudinary.com/ccc/raw/upload/v1540305195/cache/c",
"secure_url": "https://res.cloudinary.com/ccc/raw/upload/v1540305195/cache/c",
"original_filename": "file"
}
}
}
shrine Initializer code for determine_mime_type:
require "cloudinary"
require "shrine/storage/cloudinary"
require "shrine/storage/s3"
Shrine.storages = {
cache: Shrine::Storage::Cloudinary.new(store_data: true, prefix: "cache", resource_type: :raw),
store: Shrine::Storage::Cloudinary.new(store_data: true),
s3_cache: Shrine::Storage::S3.new(prefix: :cache, access_key_id: aws_settings['k'], region: 'eu-west-1', secret_access_key: aws_settings['k'], bucket: aws_settings['b']),
s3: Shrine::Storage::S3.new(access_key_id: aws_settings['k'], region: 'eu-west-1', secret_access_key: aws_settings['k'], bucket: aws_settings['b'])
}
Shrine.plugin :activerecord
Shrine.plugin :cached_attachment_data
Shrine.plugin :determine_mime_type
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (12 by maintainers)
Commits related to this issue
- Fail when file command returned error in stdout It appears that the file command can also fail with a successful exit status, in which case the error is returned in stdout. This commit handles that. ... — committed to shrinerb/shrine by janko 6 years ago
- Fail when file command returned error in stdout It appears that the file command can also fail with a successful exit status, in which case the error is returned in stdout. This commit handles that. ... — committed to shrinerb/shrine by janko 6 years ago
- Fail when file command returned error in stdout It appears that the file command can also fail with a successful exit status, in which case the error is returned in stdout. This commit handles that. ... — committed to shrinerb/shrine by janko 6 years ago
- Fail when file command returned error in stdout (#304) It appears that the file command can also fail with a successful exit status, in which case the error is returned in stdout. This commit handl... — committed to shrinerb/shrine by janko 6 years ago
Once you switch to the new analyzer, you can fix the files that have an error with a code like this:
Where you can replace
Record
with your model, andattachment
with your attachment name.