diff options
| author | Koza <[email protected]> | 2023-04-12 19:19:41 +0200 |
|---|---|---|
| committer | Koza <[email protected]> | 2023-04-12 19:43:01 +0200 |
| commit | aa1ef598f4ec5990cc5e9e43bf37b5e04cccdecc (patch) | |
| tree | 6a1852bf6780332ba2516dad8fc6fa6c38b4f99c /lib | |
| parent | 383195708d2c16c9fa132738c41ac895ac701a9e (diff) | |
| download | caxlsx-aa1ef598f4ec5990cc5e9e43bf37b5e04cccdecc.tar.gz caxlsx-aa1ef598f4ec5990cc5e9e43bf37b5e04cccdecc.zip | |
Fix missing URI.open for ruby < 2.5
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/util/mime_type_utils.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |
