From ab524293df93e252de444e35aeb390a8d6d23200 Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Sun, 18 Aug 2024 18:59:40 +0300 Subject: [PATCH] Fix ActiveStorage type detection for email files Fixes #555 --- lib/active_storage/service/cloudinary_service.rb | 2 +- spec/active_storage/service/cloudinary_service_spec.rb | 2 +- spec/spec_helper.rb | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/active_storage/service/cloudinary_service.rb b/lib/active_storage/service/cloudinary_service.rb index 87103dd3..43f2d3ca 100644 --- a/lib/active_storage/service/cloudinary_service.rb +++ b/lib/active_storage/service/cloudinary_service.rb @@ -255,7 +255,7 @@ def content_type_to_resource_type(content_type) case type when 'video', 'audio' 'video' - when 'text' + when 'text', 'message' 'raw' when 'application' case subtype diff --git a/spec/active_storage/service/cloudinary_service_spec.rb b/spec/active_storage/service/cloudinary_service_spec.rb index f4fe235d..2ab31b4b 100644 --- a/spec/active_storage/service/cloudinary_service_spec.rb +++ b/spec/active_storage/service/cloudinary_service_spec.rb @@ -108,7 +108,7 @@ it "should set raw resource_type for raw formats" do key = SecureRandom.base58(24) - types = %w[text/* application/*] + types = %w[text/* application/* message/*] types.each do |content_type| url = @service.url_for_direct_upload(key, content_type: content_type) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b912392d..5eed8387 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,6 @@ SUFFIX = ENV['TRAVIS_JOB_ID'] || rand(999999999).to_s +require 'bundler/setup' require 'rspec' require 'rspec/retry' require 'rexml/parsers/ultralightparser'