jr-paperclip 8.0.5 → 8.0.6
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 +4 -4
- data/NEWS +7 -0
- data/README.md +4 -0
- data/VIPS_MIGRATION_GUIDE.md +3 -3
- data/lib/paperclip/geometry_detector_factory.rb +1 -5
- data/lib/paperclip/processor.rb +1 -5
- data/lib/paperclip/thumbnail.rb +9 -0
- data/lib/paperclip/version.rb +1 -1
- data/lib/paperclip.rb +17 -0
- metadata +43 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2020e672706019bc2f09c85e93f350cb076e1734e3b86d6083d57f41d6f0a62e
|
|
4
|
+
data.tar.gz: c18c81c981656da9ee280b5394123e5bb965ce2ca50b9cacf0e6fbacc7dddeaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20acbf5988e931bbf2825b4d9515dce71bbf9f854ae307b235ec280b9e71d023cd17bd63a3c9cc7dd217f8311c3d882a7311ed42d275c5d5f65da2d73dff9a9c
|
|
7
|
+
data.tar.gz: 31e48aaa2f00722b445bcc1fc7af6bc1f1440cbc6ee6632442c5c9e234fb15fb8e485bf8e41af84ced410949a129231f6c18e154f387f7401d5a6819548631eb
|
data/NEWS
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
8.0.6 (2026-05-22)
|
|
2
|
+
|
|
3
|
+
* Chore: Update image_processing runtime dependency to ~> 2.0
|
|
4
|
+
* Chore: Add explicit mini_magick and ruby-vips runtime dependencies now that image_processing treats them as soft dependencies
|
|
5
|
+
* Security: Pick up image_processing 2.0.1 loader/saver option hardening
|
|
6
|
+
* Behavior: Vips backend now follows image_processing 2.x defaults, including blocked unfuzzed loaders and no post-resize sharpening by default
|
|
7
|
+
|
|
1
8
|
8.0.5 (2026-05-21)
|
|
2
9
|
|
|
3
10
|
* Improvement: Avoid anonymous evals
|
data/README.md
CHANGED
|
@@ -103,6 +103,7 @@ Paperclip now requires Ruby version **>= 3.0** and Rails version **>= 7.0**
|
|
|
103
103
|
### Image Processor
|
|
104
104
|
|
|
105
105
|
Paperclip supports two main image processing backends: **ImageMagick** (default) and **libvips** (recommended for performance).
|
|
106
|
+
`jr-paperclip` depends on the `image_processing`, `mini_magick`, and `ruby-vips` gems directly, so applications normally only need to install the system image library for the backend they use.
|
|
106
107
|
|
|
107
108
|
#### ImageMagick
|
|
108
109
|
|
|
@@ -163,6 +164,8 @@ You can also specify the backend per-attachment (see [Image Processing Backends]
|
|
|
163
164
|
|
|
164
165
|
**Note on Geometry Detection:** When `vips` is the active backend, Paperclip uses the ruby-vips gem to determine image dimensions instead of ImageMagick's `identify` command.
|
|
165
166
|
|
|
167
|
+
**Note on Untrusted Loaders:** `image_processing` 2.x asks libvips to block operations and loaders marked as untrusted by default. The affected formats depend on the libvips version and enabled loader libraries in your build. If formats such as PDF, SVG, JPEG-XL, RAW, OpenSlide, NIFTI, FITS, MATLAB, or Analyze6 are rejected, use the ImageMagick backend for those inputs, or set `VIPS_BLOCK_UNTRUSTED=0` before loading `image_processing/vips` only for trusted inputs.
|
|
168
|
+
|
|
166
169
|
### `file`
|
|
167
170
|
|
|
168
171
|
The Unix [`file` command](https://en.wikipedia.org/wiki/File_(command)) is required for content-type checking.
|
|
@@ -801,6 +804,7 @@ For a full list of variables and description, see [ImageMagick's resources docum
|
|
|
801
804
|
### libvips (Recommended for Performance)
|
|
802
805
|
|
|
803
806
|
libvips is significantly faster and uses less memory than ImageMagick. Paperclip uses the `image_processing` gem (via `ruby-vips`) to interface with libvips.
|
|
807
|
+
With `image_processing` 2.x, libvips blocks operations and loaders marked as untrusted by default; the exact affected formats vary by libvips build and version.
|
|
804
808
|
|
|
805
809
|
**Usage:**
|
|
806
810
|
|
data/VIPS_MIGRATION_GUIDE.md
CHANGED
|
@@ -21,7 +21,7 @@ sudo apt install libvips-tools
|
|
|
21
21
|
|
|
22
22
|
## Step 1: Update your Gemfile
|
|
23
23
|
|
|
24
|
-
`jr-paperclip`
|
|
24
|
+
`jr-paperclip` depends on the `image_processing`, `ruby-vips`, and `mini_magick` gems directly. You do **not** need to add these gems explicitly to your `Gemfile` unless your application wants to override their version constraints.
|
|
25
25
|
|
|
26
26
|
Ensure you are using the latest version of the gem:
|
|
27
27
|
|
|
@@ -134,6 +134,6 @@ has_attached_file :document,
|
|
|
134
134
|
|
|
135
135
|
## Important Considerations
|
|
136
136
|
|
|
137
|
-
1. **Output Parity**: While libvips aims for high quality, its resizing algorithms (Lanczos) may produce slightly different visual results than ImageMagick.
|
|
138
|
-
2. **PDF/SVG Support**: libvips requires additional libraries (like `poppler` or `librsvg`) to process these formats.
|
|
137
|
+
1. **Output Parity**: While libvips aims for high quality, its resizing algorithms (Lanczos) may produce slightly different visual results than ImageMagick. `image_processing` 2.x also no longer applies post-resize sharpening by default.
|
|
138
|
+
2. **PDF/SVG Support**: libvips requires additional libraries (like `poppler` or `librsvg`) to process these formats. With `image_processing` 2.x, operations and loaders marked as untrusted may be blocked by default, and the exact affected formats vary by libvips build and version. Use ImageMagick for blocked formats or set `VIPS_BLOCK_UNTRUSTED=0` only for trusted inputs.
|
|
139
139
|
3. **Exotic Formats**: If you rely on very specific ImageMagick features (like specialized filters or complex layer manipulation), test those attachments thoroughly before switching.
|
|
@@ -47,11 +47,7 @@ module Paperclip
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def vips_geometry_string
|
|
50
|
-
|
|
51
|
-
require "vips"
|
|
52
|
-
rescue LoadError => e
|
|
53
|
-
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips.")
|
|
54
|
-
end
|
|
50
|
+
Paperclip.require_vips
|
|
55
51
|
|
|
56
52
|
begin
|
|
57
53
|
# Use ruby-vips gem directly instead of shelling out to vipsheader
|
data/lib/paperclip/processor.rb
CHANGED
|
@@ -79,11 +79,7 @@ module Paperclip
|
|
|
79
79
|
# @param options [Hash] Options to pass to Vips::Image.new_from_file
|
|
80
80
|
# @return [Vips::Image] The loaded image
|
|
81
81
|
def vips_image(file_path, **options)
|
|
82
|
-
|
|
83
|
-
require "vips"
|
|
84
|
-
rescue LoadError
|
|
85
|
-
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips.")
|
|
86
|
-
end
|
|
82
|
+
Paperclip.require_vips
|
|
87
83
|
Vips::Image.new_from_file(file_path, **options)
|
|
88
84
|
end
|
|
89
85
|
end
|
data/lib/paperclip/thumbnail.rb
CHANGED
|
@@ -148,6 +148,11 @@ module Paperclip
|
|
|
148
148
|
elsif defined?(::MiniMagick::Error) && (e.is_a?(::MiniMagick::Error) || e.is_a?(::MiniMagick::Invalid))
|
|
149
149
|
handle_error(e, "ImageMagick")
|
|
150
150
|
elsif defined?(::ImageProcessing::Error) && e.is_a?(::ImageProcessing::Error)
|
|
151
|
+
if backend_dependency_error?(e)
|
|
152
|
+
raise Paperclip::Errors::CommandNotFoundError.new(
|
|
153
|
+
"Could not run the command for #{backend}. Please install dependencies.",
|
|
154
|
+
)
|
|
155
|
+
end
|
|
151
156
|
handle_error(e, "ImageProcessing")
|
|
152
157
|
else
|
|
153
158
|
raise e
|
|
@@ -666,5 +671,9 @@ module Paperclip
|
|
|
666
671
|
@file
|
|
667
672
|
end
|
|
668
673
|
end
|
|
674
|
+
|
|
675
|
+
def backend_dependency_error?(error)
|
|
676
|
+
error.message.match?(/ImageProcessing::(?:MiniMagick|Vips) requires/)
|
|
677
|
+
end
|
|
669
678
|
end
|
|
670
679
|
end
|
data/lib/paperclip/version.rb
CHANGED
data/lib/paperclip.rb
CHANGED
|
@@ -90,6 +90,23 @@ module Paperclip
|
|
|
90
90
|
backend
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
+
def self.require_vips
|
|
94
|
+
return if @vips_loaded
|
|
95
|
+
|
|
96
|
+
require "vips"
|
|
97
|
+
block_untrusted_vips_loaders
|
|
98
|
+
@vips_loaded = true
|
|
99
|
+
rescue LoadError
|
|
100
|
+
raise Errors::CommandNotFoundError.new("Could not load ruby-vips. Please install libvips.")
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def self.block_untrusted_vips_loaders
|
|
104
|
+
return if ENV["VIPS_BLOCK_UNTRUSTED"]
|
|
105
|
+
return unless defined?(::Vips) && ::Vips.respond_to?(:block_untrusted)
|
|
106
|
+
|
|
107
|
+
::Vips.block_untrusted(true)
|
|
108
|
+
end
|
|
109
|
+
|
|
93
110
|
# Provides configurability to Paperclip. The options available are:
|
|
94
111
|
# * whiny: Will raise an error if Paperclip cannot process thumbnails of
|
|
95
112
|
# an uploaded image. Defaults to true.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jr-paperclip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.0.
|
|
4
|
+
version: 8.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jukka Rautanen
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '2.0'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '2.0'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: marcel
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,6 +79,46 @@ dependencies:
|
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: mini_magick
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 4.9.5
|
|
89
|
+
- - "<"
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '6'
|
|
92
|
+
type: :runtime
|
|
93
|
+
prerelease: false
|
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
95
|
+
requirements:
|
|
96
|
+
- - ">="
|
|
97
|
+
- !ruby/object:Gem::Version
|
|
98
|
+
version: 4.9.5
|
|
99
|
+
- - "<"
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '6'
|
|
102
|
+
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: ruby-vips
|
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: 2.0.17
|
|
109
|
+
- - "<"
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '3'
|
|
112
|
+
type: :runtime
|
|
113
|
+
prerelease: false
|
|
114
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
115
|
+
requirements:
|
|
116
|
+
- - ">="
|
|
117
|
+
- !ruby/object:Gem::Version
|
|
118
|
+
version: 2.0.17
|
|
119
|
+
- - "<"
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: '3'
|
|
82
122
|
- !ruby/object:Gem::Dependency
|
|
83
123
|
name: terrapin
|
|
84
124
|
requirement: !ruby/object:Gem::Requirement
|