Skip to content

Commit

Permalink
Remove unnecessary branch in urlsafe_decode64 in column_encryption pl…
Browse files Browse the repository at this point in the history
…ugin

Sequel always generates the base64 with = padding, so we don't need
to check for unpadded base64 and adjust.
  • Loading branch information
jeremyevans committed Sep 20, 2023
1 parent 5f183dd commit ebe04fd
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/sequel/plugins/column_encryption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,7 @@ def urlsafe_encode64(bin)
end

def urlsafe_decode64(str)
if str.length % 4 == 0
str = str.tr("-_", "+/")
else
str = str.ljust((str.length + 3) & ~3, "=")
str.tr!("-_", "+/")
end
decode64(str)
decode64(str.tr("-_", "+/"))
end

# An array of strings, one for each configured encryption key, to find encypted values matching
Expand Down

0 comments on commit ebe04fd

Please sign in to comment.