From 4c5165e84021d8e9ba25ac553ede2d072b09ebaa Mon Sep 17 00:00:00 2001 From: eal Date: Mon, 5 Feb 2018 16:20:07 +0200 Subject: [PATCH] Accept webfinger without a key. --- lib/pleroma/web/web_finger/web_finger.ex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 95e717b17..937b45292 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -64,8 +64,12 @@ defmodule Pleroma.Web.WebFinger do end defp webfinger_from_xml(doc) do - magic_key = XML.string_from_xpath(~s{//Link[@rel="magic-public-key"]/@href}, doc) - "data:application/magic-public-key," <> magic_key = magic_key + magic_key = with key <- XML.string_from_xpath(~s{//Link[@rel="magic-public-key"]/@href}, doc), + "data:application/magic-public-key," <> magic_key <- key do + magic_key + else + _e -> nil + end topic = XML.string_from_xpath(~s{//Link[@rel="http://schemas.google.com/g/2010#updates-from"]/@href}, doc) subject = XML.string_from_xpath("//Subject", doc) salmon = XML.string_from_xpath(~s{//Link[@rel="salmon"]/@href}, doc)