Web.RelMe: Fix having other values in rel attr

One example of this is Github which puts a rel="nofollow me" on the
profile link.
This commit is contained in:
Haelwenn (lanodan) Monnier 2019-03-05 02:03:44 +01:00
commit 788a354ce0
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
4 changed files with 29 additions and 1 deletions

View file

@ -28,7 +28,8 @@ defmodule Pleroma.Web.RelMe do
{:ok, %Tesla.Env{body: html}} = Pleroma.HTTP.get(url, [], adapter: @hackney_options)
data =
Floki.attribute(html, "link[rel=me]", "href") ++ Floki.attribute(html, "a[rel=me]", "href")
Floki.attribute(html, "link[rel~=me]", "href") ++
Floki.attribute(html, "a[rel~=me]", "href")
{:ok, data}
rescue