Fix Ruby 3.1 / Psych 4.0 compatibility
This commit is contained in:
commit
447358191b
33
rubygem-crack-0.4.5-Use-named-parameters-for-safe_load.patch
Normal file
33
rubygem-crack-0.4.5-Use-named-parameters-for-safe_load.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 7fa8d8aea4a041969e433debef7f4d5d59881ae2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
||||
Date: Fri, 11 Mar 2022 18:29:43 +0100
|
||||
Subject: [PATCH] Use named parameters for `safe_load`.
|
||||
|
||||
This is available since Psych 3.1 [[1], [2]], but mandatory since Psych
|
||||
4.0 [[3]].
|
||||
|
||||
Fixes #72
|
||||
|
||||
[1]: https://github.com/ruby/psych/pull/358
|
||||
[2]: https://github.com/ruby/psych/pull/378
|
||||
[3]: https://github.com/ruby/psych/commit/0767227051dbddf1f949eef512c174deabf22891
|
||||
---
|
||||
lib/crack/json.rb | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/crack/json.rb b/lib/crack/json.rb
|
||||
index 1a27ac7..528aad6 100644
|
||||
--- a/lib/crack/json.rb
|
||||
+++ b/lib/crack/json.rb
|
||||
@@ -13,7 +13,7 @@ module Crack
|
||||
|
||||
def self.parse(json)
|
||||
yaml = unescape(convert_json_to_yaml(json))
|
||||
- YAML.safe_load(yaml, [Regexp, Date, Time])
|
||||
+ YAML.safe_load(yaml, permitted_classes: [Regexp, Date, Time])
|
||||
rescue *parser_exceptions
|
||||
raise ParseError, "Invalid JSON string"
|
||||
rescue Psych::DisallowedClass
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@ -3,11 +3,13 @@
|
||||
Summary: Really simple JSON and XML parsing, ripped from Merb and Rails
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 0.4.5
|
||||
Release: 1
|
||||
Release: 2
|
||||
License: MIT
|
||||
URL: https://github.com/jnunemaker/crack
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
Source1: crack-%{version}-tests.tar.gz
|
||||
# https://github.com/jnunemaker/crack/pull/73
|
||||
Patch0: rubygem-crack-0.4.5-Use-named-parameters-for-safe_load.patch
|
||||
# ruby package has just soft dependency on rubygem(bigdecimal), while
|
||||
# crack always requires it.
|
||||
Requires: rubygem(bigdecimal)
|
||||
@ -31,6 +33,7 @@ This package contains documentation for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{gem_name}-%{version} -b 1
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
# Create the gem as gem install only works on a gem file
|
||||
@ -61,7 +64,10 @@ popd
|
||||
%doc %{gem_docdir}
|
||||
|
||||
%changelog
|
||||
* Tue Mar 29 liyanan <liyanan32@huawei.com> - 0.4.5-1
|
||||
* Wed Jan 4 2023 liyanan <liyanan32@h-partners.com> - 1:0.4.5-2
|
||||
- Fix Ruby 3.1 / Psych 4.0 compatibility
|
||||
|
||||
* Tue Mar 29 2022 liyanan <liyanan32@huawei.com> - 0.4.5-1
|
||||
- update to 0.4.5
|
||||
|
||||
* Mon Jul 27 2020 wangxiao <wangxiao65@huawei.com> - 0.4.2-1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user