From d9264eed94e4cc0a8f44f451dbc199997b8efb05 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 15 Jun 2024 23:12:57 +0100 Subject: [PATCH] Handle base64 with newlines --- lib/ff_bot/policy.ex | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/ff_bot/policy.ex b/lib/ff_bot/policy.ex index 49ead2a..2102e41 100644 --- a/lib/ff_bot/policy.ex +++ b/lib/ff_bot/policy.ex @@ -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