mini_magick 4.9.4 → 4.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ab4ce03957b9a0f941f9bd2c34a5dcab63faffac5143eb6e7c90d7d860b57c5
4
- data.tar.gz: 7bd78f0c862f1ca72b34e3c6fc4d14297adfa9dd6bc36218a35ef68c235320b5
3
+ metadata.gz: 66e2c6af6925e0ecc26c917f270ff575986489977416754ecc89db3bbab04dee
4
+ data.tar.gz: cac982bbd12f543f637dce9a6fc8ed9e6c2139f7010d9da82f53a510ef2e2525
5
5
  SHA512:
6
- metadata.gz: 16c4bfa3744a2bea117bff0118afcbf89fac2f3d9e92c5c8af2b095f6c1381c1d000bede5086ccffd72ecca8152845cde11a5ff762186bd90793ee5d83e03a77
7
- data.tar.gz: fe593ad2a7bfd4b6f2d9892533fd5347046e7dfb6cfd8e3bc6049cb1ae7686f5af60c23f33254175bca4728a58bdeeab2b9bfb873ebd94c46f14e68e086f002f
6
+ metadata.gz: 03d841baabdc47d95a763010f113cfbc6d0acdf1ca8894e16c80bb86e307516b0f00da4c55617e5207360e4eb7bbb1e5268f5da62dabd4eb291da3d029354fdf
7
+ data.tar.gz: 201f2187bedeb2db3157f15f611c026216b083b1e0174c67389a3a157976c0b887e211fc1e6bd2286736f27f04940f6c29586fd00d5079b6c2573e38a1739da4
@@ -82,16 +82,27 @@ module MiniMagick
82
82
  def self.open(path_or_url, ext = nil, options = {})
83
83
  options, ext = ext, nil if ext.is_a?(Hash)
84
84
 
85
- uri = URI(path_or_url.to_s)
86
-
87
- ext ||= File.extname(uri.path)
88
- ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
85
+ # Don't use Kernel#open, but reuse its logic
86
+ openable =
87
+ if path_or_url.respond_to?(:open)
88
+ path_or_url
89
+ elsif path_or_url.respond_to?(:to_str) &&
90
+ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ path_or_url &&
91
+ (uri = URI.parse(path_or_url)).respond_to?(:open)
92
+ uri
93
+ else
94
+ options = { binmode: true }.merge(options)
95
+ Pathname(path_or_url)
96
+ end
89
97
 
90
- if uri.is_a?(URI::HTTP) || uri.is_a?(URI::FTP)
91
- uri.open(options) { |file| read(file, ext) }
98
+ if openable.is_a?(URI::Generic)
99
+ ext ||= File.extname(openable.path)
92
100
  else
93
- File.open(uri.to_s, "rb", options) { |file| read(file, ext) }
101
+ ext ||= File.extname(openable.to_s)
94
102
  end
103
+ ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
104
+
105
+ openable.open(options) { |file| read(file, ext) }
95
106
  end
96
107
 
97
108
  ##
@@ -9,7 +9,7 @@ module MiniMagick
9
9
  module VERSION
10
10
  MAJOR = 4
11
11
  MINOR = 9
12
- TINY = 4
12
+ TINY = 5
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.4
4
+ version: 4.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Johnson
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2019-07-11 00:00:00.000000000 Z
16
+ date: 2019-07-18 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake