From aa1ef598f4ec5990cc5e9e43bf37b5e04cccdecc Mon Sep 17 00:00:00 2001 From: Koza Date: Wed, 12 Apr 2023 19:19:41 +0200 Subject: Fix missing URI.open for ruby < 2.5 --- lib/axlsx/util/mime_type_utils.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/axlsx/util/mime_type_utils.rb b/lib/axlsx/util/mime_type_utils.rb index 5a6ad38e..f0c3afb1 100644 --- a/lib/axlsx/util/mime_type_utils.rb +++ b/lib/axlsx/util/mime_type_utils.rb @@ -14,7 +14,11 @@ module Axlsx # @param [String] v URI # @return [String] File mime type def self.get_mime_type_from_uri(v) - Marcel::MimeType.for(URI.open(v)) + if URI.respond_to?(:open) + Marcel::MimeType.for(URI.open(v)) + else + Marcel::MimeType.for(URI.parse(v).open) + end end end end -- cgit v1.2.3