Activity deletion: fix FunctionClauseError #2686
authorAlex Gleason <alex@alexgleason.me>
Fri, 25 Jun 2021 02:00:23 +0000 (21:00 -0500)
committerAlex Gleason <alex@alexgleason.me>
Fri, 25 Jun 2021 02:03:31 +0000 (21:03 -0500)
lib/pleroma/activity.ex

index 53beca5e6b0c7f6f057c916182ef2f44b30e05d2..7e36c1b5343d40abb1f52377f962d0fc8774e6c8 100644 (file)
@@ -313,13 +313,15 @@ defmodule Pleroma.Activity do
 
   def delete_all_by_object_ap_id(_), do: nil
 
-  defp purge_web_resp_cache(%Activity{} = activity) do
-    %{path: path} = URI.parse(activity.data["id"])
-    @cachex.del(:web_resp_cache, path)
+  defp purge_web_resp_cache(%Activity{data: %{"id" => id}} = activity) when is_binary(id) do
+    with %{path: path} <- URI.parse(id) do
+      @cachex.del(:web_resp_cache, path)
+    end
+
     activity
   end
 
-  defp purge_web_resp_cache(nil), do: nil
+  defp purge_web_resp_cache(activity), do: activity
 
   def follow_accepted?(
         %Activity{data: %{"type" => "Follow", "object" => followed_ap_id}} = activity