Skip to content

Commit

Permalink
Fixed error message in Encoding::Base64.encode and .decode (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed May 1, 2024
1 parent 6bcf60d commit 0b7efc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/ronin/support/encoding/base64.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def self.encode(data, mode: nil)
when :url_safe then ::Base64.urlsafe_encode64(data)
when nil then ::Base64.encode64(data)
else
raise(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
raise(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end

Expand All @@ -74,7 +74,7 @@ def self.decode(data, mode: nil)
when :url_safe then ::Base64.urlsafe_decode64(data)
when nil then ::Base64.decode64(data)
else
raise(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
raise(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/encoding/base64/core_ext/string_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
it do
expect {
subject.base64_encode(mode: mode)
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end
end
Expand Down Expand Up @@ -79,7 +79,7 @@
it do
expect {
subject.base64_decode(mode: mode)
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/encoding/base64_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
it do
expect {
subject.encode(data, mode: mode)
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end
end
Expand Down Expand Up @@ -72,7 +72,7 @@
it do
expect {
subject.decode(encoded_data, mode: mode)
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url, or nil: #{mode.inspect}")
}.to raise_error(ArgumentError,"Base64 mode must be either :string, :url_safe, or nil: #{mode.inspect}")
end
end
end
Expand Down

0 comments on commit 0b7efc4

Please sign in to comment.