Comments (3)
Yeah, so the long filename is just a symptom, really the problem is that when used with shrine-url, the query params are making their way into the id
(and thus subsequent storage path), when they shoudln't be.
I worked around in my custom code with a custom generate_location override that includes this (among other things)
basename = super
if io.respond_to?(:storage) && io.storage.is_a?(Shrine::Storage::Url)
basename = URI.parse(basename).path
end
I am not quite sure what to fix how in shrine itself though, more cleanly.
from shrine-url.
I would try to add a failing test... but I notice now shrine-url doesn't even have any tests, so not sure where to add it.
The tests are here: https://github.com/shrinerb/shrine-url/blob/master/test/url_test.rb 😉
Or wait, maybe it looks like the part of shrine that's extracting the filename suffix (to preserve it as it gets promoted), needs to be smart enough to ignore query parameter at the end, in order to be compatible with shrine-url? That might be it?
Yeah, good catch, that seems to be it:
[1] pry(main)> File.extname("filename.tif?x-amz-algorithm=aws4-hmac-sha256&x-amz-credential=akiajorcl6txivhsdrhq%2f20181119%2fus-east-1%2fs3%2faws4_request&x-amz-date=20181119t182037z&x-amz-expires=14400&x-amz-signedheaders=host&x-amz-signature=fakefake45db944222adfadfadfadf7d20eacce3e6d062979f993db0ffa1e6e")
=> ".tif?x-amz-algorithm=aws4-hmac-sha256&x-amz-credential=akiajorcl6txivhsdrhq%2f20181119%2fus-east-1%2fs3%2faws4_request&x-amz-date=20181119t182037z&x-amz-expires=14400&x-amz-signedheaders=host&x-amz-signature=fakefake45db944222adfadfadfadf7d20eacce3e6d062979f993db0ffa1e6e"
Feel free to send the PR if you can, thanks 😃
from shrine-url.
I wonder if a question mark could hypothetically be a real file suffix. This gets weirdly complicated to do reliably, but I'm going to PR something cause I think it needs fixing.
from shrine-url.
Related Issues (6)
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 shrine-url.