Comments (17)
Hi Miguel,
Thanks for contacting us.
I hate to ask a potentially silly question, but are you certainly using v1.21.0 of the SDK in both your production and development environments?
I ask because v1.19.0 of the Ruby SDK included a bugfix to resolve an issue that's very similar to what you've described here, and earlier versions can be expected to have this error in the scenario you've described.
The code that was added and an accompanying note can be seen here:
cloudinary_gem/lib/active_storage/service/cloudinary_service.rb
Lines 75 to 85 in b6f084b
If you do have v1.21.0 (or some other version above 1.19.0), were you able to identify any common factor for the requests that fail? Is the upload filename, including the extension, certainly available to your frontend code, for it to be passed to our SDK and from there to our API?
Thanks,
Stephen
from cloudinary_gem.
Hello @igy thanks for your answer,
I tried to even lock the version in the gemfile gem 'cloudinary', '~> 1.21.0'
but it didn't work It does not detect.
Ive unpacked the gem and debugged using byebug, i found the following results:
Here content_type is '' as io is nil and the key is just a string, this method is called here
thus when calling content_type_to_resource_type
with content_type as empty string it returns an image
from cloudinary_gem.
Ive done a couple of modifications to sort this issue:
Ive modified the resource_type method to accept a third argument
Also moved the guard clause in the ext_for_file method
It works for me but I dont know if I break any other uses of this gem
from cloudinary_gem.
If you open rails console in that project, what version do you get?
from cloudinary_gem.
It's 5.2.2
from cloudinary_gem.
My apologies, I meant to say, can you do this:
rails c
require 'cloudinary'
Cloudinary::VERSION
I just want to make sure the cloudinary version is right.
from cloudinary_gem.
from cloudinary_gem.
Ive been reviewing the code of active storage to check differences between 5.2 and 7.0
5.2 activestorage/app/controllers
Differences are massive, it is probably the cause of the issue.
from cloudinary_gem.
I'm checking internally and will keep you posted.
from cloudinary_gem.
I've opened an internal ticket for this issue and will keep you posted.
from cloudinary_gem.
Thank you @momoip
from cloudinary_gem.
@Mrodrides Of course. Will for sure let you know when the issue is fixed and deployed.
from cloudinary_gem.
@Mrodrides apologies for the delay, so we tested with csv files and cannot replicate on Rails 7.0.4
We got valid upload URLs and everything works as expected. We always saw the file content type detected right.
Are you still having this issue? If so, is it with specific CSV files and can you send us this file? Does upgrading to rails 7.0.4 help as well?
from cloudinary_gem.
Previously we had to vendorize the gem and modify it there but now we have upgraded raise and teared down all the internal hacks, so is back to normal.
Everything works correctly with the images and pdfs, but the raw files are still problematic, and worst of all the bugs are not consitent.
When for example i upload a csv, docx or a txt file, sometimes the url has the extension and sometimes it does not.
So when for example it is displayed in the app through the 'attachment.url(secure: true)' it leads to a 404, removing or adding .csv, .txt or .docx on the file solves the issue.
I have to remark here that we only use direct uploads.
On the other side, i notice that when in the console i do
As you can see, one has the format and the other not
from cloudinary_gem.
@Mrodrides thanks for getting back. How often are you seeing extensions not being included for raw files? Do you see any pattern in them? And is it happening on random raw files?
from cloudinary_gem.
@Mrodrides cloudinary_url()
is a generic SDK function for building URLs.
For Active Storage integration please only use .url
function. The difference between them is that it uses content type to identify file extension when needed (for raw files in this case).
Can you please provide an example of a csv/docx/txt file that leads to 404? so we can investigate it further?
Thank you!
from cloudinary_gem.
We were experiencing this same problem. We were on v1.23.0
and the fix included in v.1.24.0
found here resolved it.
from cloudinary_gem.
Related Issues (20)
- Some kind of overlay texts generate urls which cause `400 Bad Request` HOT 7
- Support Dynamic Folder upload parameters HOT 2
- How to get value txt file? HOT 3
- Update API is missing metadata support HOT 3
- Conditional metadata rules support HOT 6
- Broken urls - Unsafe characters in public_id are not properly escaped by Cloudinary::Utils.cloudinary_url HOT 2
- Photo metadata is nil until after AR callbacks have run HOT 7
- Unable to upload multiple images to cloudinary HOT 1
- ActiveStorage: Non-image file is not deleted when its blob is destroyed HOT 4
- ActiveStorage support for upload_large HOT 2
- Update sample projects dependencies HOT 4
- preview:duration effect was shortened to preview:du when uploading a video HOT 1
- Access token url generation returns 404 HOT 2
- The gem breaks the lazy loading of ActionView::Base HOT 1
- Contextual metadata support for url_for_direct_upload HOT 2
- Invalid Remote Fetch URL if `folder` is set in Storage Service Config HOT 9
- Transformation params not properly URL escaped HOT 3
- 2.0: Rake task fail with `LoadError` on `faraday/follow_redirects` HOT 4
- Cannot view an image using the cl_image_tag after a new upload, getting key not found: :type error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudinary_gem.