Commit c919514e by Prem Sichanugrist

Fix data-uri with mime type that has `.` in it

Fixes #1550
parent 1850f93d
module Paperclip
class DataUriAdapter < StringioAdapter
REGEXP = /\Adata:([-\w]+\/[-\w\+]+)?;base64,(.*)/m
REGEXP = /\Adata:([-\w]+\/[-\w\+\.]+)?;base64,(.*)/m
def initialize(target_uri)
super(extract_target(target_uri))
......
......@@ -12,6 +12,11 @@ describe Paperclip::DataUriAdapter do
assert_equal Paperclip::DataUriAdapter, adapter.class
end
it 'alows mime type that has dot in it' do
adapter = Paperclip.io_adapters.for("data:image/vnd.microsoft.icon;base64,#{original_base64_content}")
assert_equal Paperclip::DataUriAdapter, adapter.class
end
context "a new instance" do
before do
@contents = "data:image/png;base64,#{original_base64_content}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment