Skip to content
This repository
Browse code

Allow importing base64 strings without "=" padding.

  • Loading branch information...
commit 0c5f4f429828f17f9066da2f3ebba655ac58800b 1 parent c127288
Marti Kaljuve martikaljuve authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  lib/chunky_png/canvas/data_url_importing.rb
2  lib/chunky_png/canvas/data_url_importing.rb
@@ -10,7 +10,7 @@ module DataUrlImporting
10 10 # @raise ChunkyPNG::SignatureMismatch if the provides string is not a properly
11 11 # formatted PNG data URL (i.e. it should start with "data:image/png;base64,")
12 12 def from_data_url(string)
13   - if string =~ %r[^data:image/png;base64,((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=))$]
  13 + if string =~ %r[^data:image/png;base64,((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)$]
14 14 from_blob($1.unpack('m').first)
15 15 else
16 16 raise SignatureMismatch, "The string was not a properly formatted data URL for a PNG image."

0 comments on commit 0c5f4f4

Please sign in to comment.
Something went wrong with that request. Please try again.