Skip to content

Commit

Permalink
Handle base64 with newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 committed Jun 15, 2024
1 parent f3f6d76 commit d9264ee
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/ff_bot/policy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ defmodule FFBot.Policy do
end

defp parse_file(contents) do
# Decode the content from base64 and traim trailing spaces/newlines.
decoded_content =
contents
|> String.trim_trailing()
|> Base.decode64!()
|> String.trim_trailing()
# Decode the content from base64 (maybe with newlines)
decoded_content = Base.decode64!(contents, ignore: :whitespace)

# Read and decode the YAML from the file
case YamlElixir.read_all_from_string(decoded_content) do
Expand Down

0 comments on commit d9264ee

Please sign in to comment.