From 46dba03098b2646fbfb47ccb17261221c9c26f11 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 31 Jan 2019 16:19:31 +0000 Subject: [PATCH] rich media: parser: only try to validate strings, not numbers (OEmbed) --- lib/pleroma/web/rich_media/parser.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex index b33411cc7..32dec9887 100644 --- a/lib/pleroma/web/rich_media/parser.ex +++ b/lib/pleroma/web/rich_media/parser.ex @@ -54,12 +54,14 @@ defmodule Pleroma.Web.RichMedia.Parser do {:error, "Found metadata was invalid or incomplete: #{inspect(data)}"} end - defp string_is_valid_unicode(data) do + defp string_is_valid_unicode(data) when is_binary(data) do data |> :unicode.characters_to_binary() |> clean_string() end + defp string_is_valid_unicode(data), do: {:ok, data} + defp clean_string({:error, _, _}), do: {:error, "Invalid data"} defp clean_string(data), do: {:ok, data} -- 2.45.2