kreeti / kt-paperclip

Easy file attachment management for ActiveRecord
Other
275 stars 95 forks source link

Base64 ICO files aren't being identified and throws a `Paperclip::Errors::NotIdentifiedByImageMagickError` #137

Open radiantshaw opened 6 months ago

radiantshaw commented 6 months ago

Describe the bug Finding the geometry of a Base64 encoded ICO file doesn't work and instead throws a Paperclip::Errors::NotIdentifiedByImageMagickError.

To Reproduce

require "base64"
require "kt-paperclip"

file = File.open("Path/To/ICO/File", "rb")
base64 = Base64.encode64(file.read)
data_uri = "data:image/vnd.microsoft.icon;base64," + base64

Paperclip::Geometry.from_file(Paperclip::DataUriAdapter.new(data_uri)) # => throws Paperclip::Errors::NotIdentifiedByImageMagickError

Expected behavior Paperclip::Geometry.find_file should return an instance of Paperclip::Geometry containing the width and height of the ICO file.

Desktop (please complete the following information):