[backend/core] Verify links that have a matching link element in their document head
This commit is contained in:
parent
da2cb76aab
commit
04a5512c61
1 changed files with 7 additions and 4 deletions
|
@ -1215,11 +1215,14 @@ public class UserService(
|
|||
var html = await res.Content.ReadAsStringAsync();
|
||||
var document = await new HtmlParser().ParseDocumentAsync(html);
|
||||
|
||||
var headLinks = document.Head?.Children.Where(el => el.NodeName.ToLower() == "link").ToList() ?? [];
|
||||
|
||||
userProfileField.IsVerified =
|
||||
document.Links.Any(a => (a.GetAttribute("rel")?.Contains("me")
|
||||
?? false)
|
||||
&& a.GetAttribute("href") == profileUrl
|
||||
|| a.GetAttribute("href") == user.GetUriOrPublicUri(instance.Value));
|
||||
headLinks.Concat(document.Links)
|
||||
.Any(a => (a.GetAttribute("rel")?.Contains("me")
|
||||
?? false)
|
||||
&& a.GetAttribute("href") == profileUrl
|
||||
|| a.GetAttribute("href") == user.GetUriOrPublicUri(instance.Value));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue