Fix background images with special characters
Just like we did for budgets, we're doing the same thing in all the places where we render background images attached by either regular users or administrators. This way we correctly render background images with characters like brackets or quotes.
This commit is contained in:
13
spec/helpers/images_helper_spec.rb
Normal file
13
spec/helpers/images_helper_spec.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
require "rails_helper"
|
||||
|
||||
describe ImagesHelper do
|
||||
describe "#attached_background_css" do
|
||||
it "adds quotes around the path" do
|
||||
expect(attached_background_css("myurl")).to eq "background-image: url('myurl');"
|
||||
end
|
||||
|
||||
it "escapes quotes inside the path" do
|
||||
expect(attached_background_css("url_'quotes'")).to eq "background-image: url('url_\\'quotes\\'');"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user