image_processing 2.0.3 → 2.1.0

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: 073bdcd7bc5e6fbb52b92f70de43d3b700316620dd23ec75b9aeac18bd5375b3
4
- data.tar.gz: 1678df6fd73afc2230fafd9c3f84b2d5174351819ef0f3961ed5206f2c6ae53b
3
+ metadata.gz: a52c42f1463cc15caf0dfe57bc8a5efeb464006a2a29bbf1b8c842ada339e4aa
4
+ data.tar.gz: 2344e1015b02f4b24363371d8877bdcc4fb28b9fb820e15d2e2446f7874443c6
5
5
  SHA512:
6
- metadata.gz: e41739ac97beb0cb48cd97be766578cac1c14b4fd86fea0dd7401b835ecfbd2c018485d12ea0cb6d3c6cfcf0d4e0355d5c011770dd7f0c74aec26e7499cb306f
7
- data.tar.gz: 7618aa5091de6ddc2a01a189e548e508d862535ad8a7f4e400845c8696fcace78081f33efc343fa220ed04d13a0a71106a7e7c10141c107764270640ad30a0a6
6
+ metadata.gz: 90c29ed45d475cc54f814a368e894504f5bc012835ef989d3678568dfb3cd29aca144e88cb17d102ffc82dcbd94c4d46de7d9a5fbc0474c0f6b15c481a1f4bb3
7
+ data.tar.gz: 8a7f991cf00725e1d5618add34f9b57814e2e273d8b9575f49e61701e80259ac8c2cd61028cdaefc6b4a6694a8a922d2246f5f6b8f7ee7184ff31bd0f8644813
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 2.0.3 (2026-06-08)
1
+ ## 2.1.0 (2026-09-01)
2
+
3
+ * [minimagick] Add `inherit_fds:` so a loader can name an already-open input (thanks to @flavorjones)
4
+
5
+ ## 2.0.3 (2026-08-06)
2
6
 
3
7
  * Prevent remote code execution when operation names come from user input, closing bypasses through the `#operation` meta-builder, `#method_missing`, and nested `#send` calls (reported by @szymonsec)
4
8
 
@@ -9,11 +9,20 @@ module ImageProcessing
9
9
  module MiniMagick
10
10
  extend Chainable
11
11
 
12
- def self.convert_shim(&block)
12
+ # mini_magick gained `inherit_fds:` on MiniMagick::Shell#execute in 5.4.0.
13
+ INHERIT_FDS_MINIMUM_VERSION = Gem::Version.new("5.4.0")
14
+
15
+ def self.convert_shim(inherit_fds: nil, &block)
16
+ if inherit_fds && ::MiniMagick.version < INHERIT_FDS_MINIMUM_VERSION
17
+ raise LoadError, "The `inherit_fds` loader option requires mini_magick #{INHERIT_FDS_MINIMUM_VERSION} or newer, but mini_magick #{::MiniMagick.version} is loaded. Please upgrade the gem."
18
+ end
19
+
20
+ options = inherit_fds ? { inherit_fds: inherit_fds } : {}
21
+
13
22
  if ::MiniMagick.respond_to?(:convert)
14
- ::MiniMagick.convert(&block)
23
+ ::MiniMagick.convert(**options, &block)
15
24
  else
16
- ::MiniMagick::Tool::Convert.new(&block)
25
+ ::MiniMagick::Tool::Convert.new(**options, &block)
17
26
  end
18
27
  end
19
28
 
@@ -37,12 +46,16 @@ module ImageProcessing
37
46
  # Initializes the image on disk into a MiniMagick::Tool object. Accepts
38
47
  # additional options related to loading the image (e.g. geometry).
39
48
  # Additionally auto-orients the image to be upright.
40
- def self.load_image(path_or_magick, loader: nil, page: nil, geometry: nil, auto_orient: true, **options)
49
+ # `inherit_fds` names IO objects the tool inherits, so the source may be a
50
+ # `/dev/fd/N` path. The source stays a path, so `loader`, `page` and
51
+ # `geometry` still apply to it, which they would not if the caller passed
52
+ # a pre-built MiniMagick::Tool carrying the descriptor.
53
+ def self.load_image(path_or_magick, loader: nil, page: nil, geometry: nil, auto_orient: true, inherit_fds: nil, **options)
41
54
  if path_or_magick.is_a?(::MiniMagick::Tool)
42
55
  magick = path_or_magick
43
56
  else
44
57
  source_path = path_or_magick
45
- magick = ::ImageProcessing::MiniMagick.convert_shim
58
+ magick = ::ImageProcessing::MiniMagick.convert_shim(inherit_fds: inherit_fds)
46
59
 
47
60
  Utils.apply_options(magick, **options)
48
61
 
@@ -1,3 +1,3 @@
1
1
  module ImageProcessing
2
- VERSION = "2.0.3"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_processing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić