/usr/lib/ruby/vendor_ruby/chunky_png/canvas/data_url_importing.rb is in ruby-chunky-png 1.2.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | module ChunkyPNG
class Canvas
# Methods to import a canvas from a PNG data URL.
module DataUrlImporting
# Imports a canvas from a PNG data URL.
# @param [String] string The data URL string to load from.
# @return [Canvas] The imported canvas.
# @raise ChunkyPNG::SignatureMismatch if the provides string is not a properly
# formatted PNG data URL (i.e. it should start with "data:image/png;base64,")
def from_data_url(string)
if string =~ %r[^data:image/png;base64,((?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)$]
from_blob($1.unpack('m').first)
else
raise SignatureMismatch, "The string was not a properly formatted data URL for a PNG image."
end
end
end
end
end
|