fix no implicit conversion of Hash into Integer
This commit is contained in:
parent
94b425e703
commit
93b78968b3
12
fix-URI-InvalidURIError-no-such-file-directory.patch
Normal file
12
fix-URI-InvalidURIError-no-such-file-directory.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -Nur a/spec/lib/mini_magick/image_spec.rb b/spec/lib/mini_magick/image_spec.rb
|
||||||
|
--- a/spec/lib/mini_magick/image_spec.rb 2022-02-25 09:21:57.370368608 +0800
|
||||||
|
+++ b/spec/lib/mini_magick/image_spec.rb 2022-02-25 09:24:14.804683516 +0800
|
||||||
|
@@ -79,7 +79,7 @@
|
||||||
|
it "doesn't allow remote shell execution" do
|
||||||
|
expect {
|
||||||
|
described_class.open("| touch file.txt") # Kernel#open accepts this
|
||||||
|
- }.to raise_error(URI::InvalidURIError)
|
||||||
|
+ }.to raise_error(Errno::ENOENT)
|
||||||
|
|
||||||
|
expect(File.exist?("file.txt")).to eq(false)
|
||||||
|
end
|
||||||
39
fix-no-implicit-conversion-of-hash-into-integer.patch
Normal file
39
fix-no-implicit-conversion-of-hash-into-integer.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
diff -Nur a/lib/mini_magick/image.rb b/lib/mini_magick/image.rb
|
||||||
|
--- a/lib/mini_magick/image.rb 2022-02-24 19:57:09.378499137 +0800
|
||||||
|
+++ b/lib/mini_magick/image.rb 2022-02-24 20:01:25.738826593 +0800
|
||||||
|
@@ -82,15 +82,30 @@
|
||||||
|
def self.open(path_or_url, ext = nil, options = {})
|
||||||
|
options, ext = ext, nil if ext.is_a?(Hash)
|
||||||
|
|
||||||
|
- uri = URI(path_or_url.to_s)
|
||||||
|
+ # Don't use Kernel#open, but reuse its logic
|
||||||
|
+ openable =
|
||||||
|
+ if path_or_url.respond_to?(:open)
|
||||||
|
+ path_or_url
|
||||||
|
+ elsif path_or_url.respond_to?(:to_str) &&
|
||||||
|
+ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ path_or_url &&
|
||||||
|
+ (uri = URI.parse(path_or_url)).respond_to?(:open)
|
||||||
|
+ uri
|
||||||
|
+ else
|
||||||
|
+ options = { binmode: true }.merge(options)
|
||||||
|
+ Pathname(path_or_url)
|
||||||
|
+ end
|
||||||
|
|
||||||
|
- ext ||= File.extname(uri.path)
|
||||||
|
+ if openable.is_a?(URI::Generic)
|
||||||
|
+ ext ||= File.extname(openable.path)
|
||||||
|
+ else
|
||||||
|
+ ext ||= File.extname(openable.to_s)
|
||||||
|
+ end
|
||||||
|
ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
|
||||||
|
|
||||||
|
- if uri.is_a?(URI::HTTP) || uri.is_a?(URI::FTP)
|
||||||
|
- uri.open(options) { |file| read(file, ext) }
|
||||||
|
+ if openable.is_a?(URI::Generic)
|
||||||
|
+ openable.open(options) { |file| read(file, ext) }
|
||||||
|
else
|
||||||
|
- File.open(uri.to_s, "rb", options) { |file| read(file, ext) }
|
||||||
|
+ openable.open(**options) { |file| read(file, ext) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
%global gem_name mini_magick
|
%global gem_name mini_magick
|
||||||
Name: rubygem-%{gem_name}
|
Name: rubygem-%{gem_name}
|
||||||
Version: 4.8.0
|
Version: 4.8.0
|
||||||
Release: 4
|
Release: 5
|
||||||
Summary: Manipulate images with minimal use of memory via ImageMagick
|
Summary: Manipulate images with minimal use of memory via ImageMagick
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/minimagick/minimagick
|
URL: https://github.com/minimagick/minimagick
|
||||||
@ -9,8 +9,10 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
|||||||
Source1: https://github.com/minimagick/minimagick/archive/v%{version}.tar.gz
|
Source1: https://github.com/minimagick/minimagick/archive/v%{version}.tar.gz
|
||||||
Patch2: CVE-2019-13574-1.patch
|
Patch2: CVE-2019-13574-1.patch
|
||||||
Patch3: CVE-2019-13574-2.patch
|
Patch3: CVE-2019-13574-2.patch
|
||||||
|
Patch4: fix-URI-InvalidURIError-no-such-file-directory.patch
|
||||||
|
Patch5: fix-no-implicit-conversion-of-hash-into-integer.patch
|
||||||
Requires: ImageMagick
|
Requires: ImageMagick
|
||||||
BuildRequires: ruby(release) rubygems-devel ruby rubygem(rspec) rubygem(webmock) ImageMagick
|
BuildRequires: ruby(release) rubygems-devel ruby rubygem(rspec) rubygem(webmock) ImageMagick rubygem(rexml)
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%description
|
%description
|
||||||
A ruby wrapper for ImageMagick command line. Using MiniMagick the ruby
|
A ruby wrapper for ImageMagick command line. Using MiniMagick the ruby
|
||||||
@ -28,6 +30,7 @@ Documentation for %{name}.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{gem_name}-%{version}
|
%setup -q -n %{gem_name}-%{version}
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
gem build ../%{gem_name}-%{version}.gemspec
|
gem build ../%{gem_name}-%{version}.gemspec
|
||||||
@ -43,6 +46,8 @@ pushd .%{gem_instdir}
|
|||||||
tar xzvf %{SOURCE1}
|
tar xzvf %{SOURCE1}
|
||||||
cd minimagick-%{version}
|
cd minimagick-%{version}
|
||||||
cat %{PATCH3} | patch -p1
|
cat %{PATCH3} | patch -p1
|
||||||
|
cat %{PATCH4} | patch -p1
|
||||||
|
cat %{PATCH5} | patch -p1
|
||||||
sed -i 's/"red"/"Red"/g' spec/lib/mini_magick/image_spec.rb
|
sed -i 's/"red"/"Red"/g' spec/lib/mini_magick/image_spec.rb
|
||||||
sed -i '/"date:create"/d' spec/lib/mini_magick/image_spec.rb
|
sed -i '/"date:create"/d' spec/lib/mini_magick/image_spec.rb
|
||||||
sed -i '/Clipping path/d' spec/lib/mini_magick/image_spec.rb
|
sed -i '/Clipping path/d' spec/lib/mini_magick/image_spec.rb
|
||||||
@ -71,6 +76,9 @@ popd
|
|||||||
%{gem_instdir}/Rakefile
|
%{gem_instdir}/Rakefile
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 24 2022 wulei <wulei80@huawei.com> - 1.0.2-5
|
||||||
|
- Fix no implicit conversion of Hash into Integer
|
||||||
|
|
||||||
* Sat Jan 15 2022 Ge Wang <wangge20@huawei.com> - 1.0.2-4
|
* Sat Jan 15 2022 Ge Wang <wangge20@huawei.com> - 1.0.2-4
|
||||||
- Fix test case failure
|
- Fix test case failure
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user