Commit 81afaee3 authored by Ilja's avatar Ilja
Browse files

Better way of getting keys

I used keyword_list[:key], but if the key doesn't exist, it will return nil. I actually expect a list and further down the code I use that list.
I believe the key should always be present, but in case it's not, it's better to return an empty list instead of nil. That way the code wont fail further down the line.
parent 75ea7668
......@@ -21,7 +21,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
def check_exiftool_filter do
filters = Config.get([Pleroma.Upload])[:filters]
filters = Config.get([Pleroma.Upload]) |> Keyword.get(:filters, [])
if Pleroma.Upload.Filter.Exiftool in filters do
......@@ -51,7 +51,7 @@ test "changes setting to exiftool strip location" do
capture_log(fn -> DeprecationWarnings.warn() end)
assert Config.get([Pleroma.Upload])[:filters] == expected_config
assert Config.get([Pleroma.Upload]) |> Keyword.get(:filters, []) == expected_config
test "doesn't give a warning with correct config" do
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment