Fix never matching clause
authorrinpatch <rinpatch@sdf.org>
Sun, 8 Dec 2019 13:36:22 +0000 (16:36 +0300)
committerrinpatch <rinpatch@sdf.org>
Sat, 8 Feb 2020 21:44:29 +0000 (00:44 +0300)
`length/1` is only used with lists.

lib/pleroma/web/activity_pub/transmogrifier.ex

index 1c67fee2eb7f52dfc4e3fd38b8e5d2464681808e..e925aae2f63b2096ff100b9c337dac360639d9eb 100644 (file)
@@ -416,7 +416,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
   def handle_incoming(%{"id" => nil}, _options), do: :error
   def handle_incoming(%{"id" => ""}, _options), do: :error
   # length of https:// = 8, should validate better, but good enough for now.
-  def handle_incoming(%{"id" => id}, _options) when not (is_binary(id) and length(id) > 8),
+  def handle_incoming(%{"id" => id}, _options) when is_binary(id) and byte_size(id) < 8,
     do: :error
 
   # TODO: validate those with a Ecto scheme