Skip to content

Correct the solution to get the content type #238

Open
@yopaz-giapnh

Description

@yopaz-giapnh

case file.path
when /\.jpe?g\z/i then 'image/jpeg'
when /\.png\z/i then 'image/png'
else
raise ArgumentError, "invalid file extension: #{file.path}"
end

If using the file with no extension, this caused an error. For eg: "/var/folders/m3/p364c0313fv0mhbl3llm4bvw0000gp/T/ActiveStorage-27-20210918-49325-1bu8npn"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions