-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug - Images: SHA is changed, if I change uploaded image #2931
Comments
It's a missing feature. |
What about to substitute image url with something like {{IMG:5}} in HTML source code of a page and this would by substituted for an image url? (this example returns image with id == 5) |
It's only idea, I don't know how to do it. |
If you are going to start offering templating in the page you will end up having to offer a lot more than that! Calling it a bug is a little harsh if you can't make it happen! |
@anitagraham You don't understand me... Try this steps:
|
@prokopsimek off to singing practise now. Will try when I get back. Can you label the later steps so that I can tell which one is image 1 and which is image 2? |
@parndt @anitagraham I did some code spelunking through the latest commit on Of course, there's chatter of SHA related issues with version A recent project of mine was based off the master branch, and for the time being I've had to kill the DOS protection in Dragonfly from causing a mess in production (the usual 'invalid SHA' provided message, even though a secret has been set). These are from
|
That dependency specification should allow Run |
Nutters, I must have a stale Gemfile.lock! Thanks @parndt |
@bsodmike , how were you able to remove the DOS protection? We're having the same problem in a production app. Is there a configuration setting in refinery core config or do I need to fork refinery and patch the fork? |
hey @brooks, I added an initialiser to override both the Refinery Images and Resources modules - as they both use Dragonfly. The upgrade from 1.0.7 to 1.0.10 Dragonfly didn't help the SHA issue, so I went with this require 'dragonfly'
Rails.application.config.before_initialize do
module Refinery
module Images
module Dragonfly
class << self
def configure!
# copy the method's code over from your version of Refinery
end
end
end
end
end
module Refinery
module Resources
module Dragonfly
class << self
def configure!
# copy the method's code over from your version of Refinery
end
end
end
end
end
end Inside each |
Thanks @bsodmike. Much appreciated. |
Refinery could offer |
@anitagraham +1 |
Pleasure @brooks |
OK, so who is keen to write the patch? |
I thought I had done that! Let me investigate... I will submit a PR. |
PR #3017. However this test fails: context "when Dragonfly.verify_urls is false" do
Refinery::Images.dragonfly_verify_urls = false
it "returns a url without an SHA parameter" do
expect(created_image.url).not_to match(/\?sha=[\da-fA-F]{16}\z/)
end
end I think because you can't change a config value mid-stream, so to speak. The url returned has got an SHA parameter. Testing in an application did work though. I was investigating how to get this to work about a month ago, but have been too busy to follow up. |
When mocking config values, you might want to use RSpec's allow feature: context "when Dragonfly.verify_urls is false" do
before { allow(Refinery::Images).to receive(:dragonfly_verify_urls).and_return(false) }
it "returns a url without an SHA parameter" do
expect(created_image.url).not_to match(/\?sha=[\da-fA-F]{16}\z/)
end
end |
@anitagraham hopefully my previous comment helps you? |
@parndt +1 RSpec's stub/mocking also allows use of |
Is it fixed ? @parndt and @anitagraham |
@bricesanchez the commit f444811 was merged which should mean this is fixed. |
@bricesanchez though, the commit just gives you a config option, so I'm not sure if that qualifies as fixing the underlying issue. |
That's what I was going to say. |
Just to summarize this: It is not bug in Refinery, but Dragonfly feature and it can be bypassed with new config in Refinery configuring Dragonfly to not use SHA in URL. Am I right and can we close this? |
@simi correct. The change in f444811 allows by-passing the underlying issue in Dragonfly, at least until I've not had time to dig into this further, but I hope to do so soon (markevans/dragonfly#387) |
"... at least until Refinery's dependency is upgraded...." @bsodmike if you run bundle update, you will be able to use the latest version of dragonfly 1.0.10 The proof in my [...]
dragonfly (1.0.10)
addressable (~> 2.3)
multi_json (~> 1.0)
rack (>= 1.3.0)
[...] |
As I recall the issue has yet to be fixed, even in the latest tagged On Wednesday, 19 August 2015, Brice Sanchez notifications@github.com
Mike's on the move! |
@bsodmike do you mean https://github.com/refinery/refinerycms/blob/master/resources/refinerycms-resources.gemspec#L23 and https://github.com/refinery/refinerycms/blob/master/images/refinerycms-images.gemspec#L22? Why we need to lock it to specific minimal version? |
Oh right, my mistake. I should have said "The change in f444811 allows by-passing the underlying issue in Dragonfly, at least until @bricesanchez good catch mate, thanks for clarifying that! |
@bsodmike as I said I think it is not bug, but it is feature of Dragonfly. |
I uploaded image called "prokop.jpg" and I added it in my page content via WYM. But now I want to change this image without to have to changing content of page, I want only edit image and to change the source file... But the SHA is changed, if I change the source file, so there is 404 image on my page...
How to resolve? Any ideas?
The text was updated successfully, but these errors were encountered: