From e7509be1631957a63e6c32835b77957337eaa5e1 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:53:42 +0100 Subject: [PATCH 1/3] Remove dependency on base64 --- lib/multi_xml.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/multi_xml.rb b/lib/multi_xml.rb index d4df77a..f3873f7 100644 --- a/lib/multi_xml.rb +++ b/lib/multi_xml.rb @@ -1,4 +1,3 @@ -require "base64" require "bigdecimal" require "date" require "stringio" @@ -43,7 +42,7 @@ def initialize(type) "boolean" => proc { |boolean| !%w[0 false].include?(boolean.strip) }, "string" => proc { |string| string.to_s }, "yaml" => proc { |yaml| YAML.load(yaml) rescue yaml }, # rubocop:disable Style/RescueModifier, Security/YAMLLoad - "base64Binary" => proc { |binary| ::Base64.decode64(binary) }, + "base64Binary" => proc { |binary| base64_decode(binary) }, "binary" => proc { |binary, entity| parse_binary(binary, entity) }, "file" => proc { |file, entity| parse_file(file, entity) } }.freeze @@ -176,20 +175,24 @@ def content_type def parse_binary(binary, entity) # :nodoc: case entity["encoding"] when "base64" - Base64.decode64(binary) + base64_decode(binary) else binary end end def parse_file(file, entity) - f = StringIO.new(Base64.decode64(file)) + f = StringIO.new(base64_decode(file)) f.extend(FileLike) f.original_filename = entity["name"] f.content_type = entity["content_type"] f end + def base64_decode(input) + input.unpack1("m") + end + def symbolize_keys(params) case params when Hash From 7d206a71b96c11bf3450d13dca6c53ccec898c3e Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:58:22 +0100 Subject: [PATCH 2/3] Add bigdecimal as a runtime dependency --- multi_xml.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/multi_xml.gemspec b/multi_xml.gemspec index 330ee83..713cd8d 100644 --- a/multi_xml.gemspec +++ b/multi_xml.gemspec @@ -31,4 +31,6 @@ Gem::Specification.new do |spec| # For more information and examples about making a new gem, check out our # guide at: https://bundler.io/guides/creating_gem.html spec.metadata["rubygems_mfa_required"] = "true" + + spec.add_runtime_dependency("bigdecimal") end From 0e94014a144059e511ce8bde25255faf427717ea Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:59:39 +0100 Subject: [PATCH 3/3] Add ruby 3.3 to CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb7af9c..6fb6544 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2'] + ruby-version: ['3.0', '3.1', '3.2', '3.3'] steps: - uses: actions/checkout@v3 @@ -30,7 +30,7 @@ jobs: # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, # change this to (see https://github.com/ruby/setup-ruby#versioning): # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 + uses: ruby/setup-ruby@360dc864d5da99d54fcb8e9148c14a84b90d3e88 # v1.165.1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically