Fix compile warning
warning: "else" clauses will never match because all patterns in "with" will always match lib/pleroma/web/rich_media/parser/ttl/opengraph.ex:10
This commit is contained in:
parent
19002fd6c1
commit
9b9a32bf74
@ -6,11 +6,12 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.Opengraph do
|
|||||||
@behaviour Pleroma.Web.RichMedia.Parser.TTL
|
@behaviour Pleroma.Web.RichMedia.Parser.TTL
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def ttl(%{"ttl" => ttl_string}, _url) do
|
def ttl(%{"ttl" => ttl_string}, _url) when is_binary(ttl_string) do
|
||||||
with ttl <- String.to_integer(ttl_string) do
|
try do
|
||||||
|
ttl = String.to_integer(ttl_string)
|
||||||
now = DateTime.utc_now() |> DateTime.to_unix()
|
now = DateTime.utc_now() |> DateTime.to_unix()
|
||||||
now + ttl
|
now + ttl
|
||||||
else
|
rescue
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user