diff options
| author | Mark Felder <feld@feld.me> | 2024-05-07 21:55:39 -0400 | 
|---|---|---|
| committer | Mark Felder <feld@feld.me> | 2024-05-07 21:56:27 -0400 | 
| commit | 9b9a32bf74a87047b3c12b468f3351950c334995 (patch) | |
| tree | 86bbc50f508565ce931878a78867cca0cc6e6e05 | |
| parent | 19002fd6c11760898daf0b5ed648d6ba58d84b97 (diff) | |
| download | pleroma-9b9a32bf74a87047b3c12b468f3351950c334995.tar.gz pleroma-9b9a32bf74a87047b3c12b468f3351950c334995.zip  | |
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
| -rw-r--r-- | lib/pleroma/web/rich_media/parser/ttl/opengraph.ex | 7 | 
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/pleroma/web/rich_media/parser/ttl/opengraph.ex b/lib/pleroma/web/rich_media/parser/ttl/opengraph.ex index fc99244c3..b06889669 100644 --- a/lib/pleroma/web/rich_media/parser/ttl/opengraph.ex +++ b/lib/pleroma/web/rich_media/parser/ttl/opengraph.ex @@ -6,11 +6,12 @@ defmodule Pleroma.Web.RichMedia.Parser.TTL.Opengraph do    @behaviour Pleroma.Web.RichMedia.Parser.TTL    @impl true -  def ttl(%{"ttl" => ttl_string}, _url) do -    with ttl <- String.to_integer(ttl_string) do +  def ttl(%{"ttl" => ttl_string}, _url) when is_binary(ttl_string) do +    try do +      ttl = String.to_integer(ttl_string)        now = DateTime.utc_now() |> DateTime.to_unix()        now + ttl -    else +    rescue        _ -> nil      end    end  | 
