Skip to content

Commit

Permalink
EM: Fix bug where Facebook profiles get added to author field (#3103)
Browse files Browse the repository at this point in the history
Fix bug where authors from open graph metadata fields only got added if they contained a Facebook link (as opposed to the intended result which is to skip the field if it did).
  • Loading branch information
mvolz authored Aug 11, 2023
1 parent 27f7112 commit 06fed1d
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions Embedded Metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"inRepository": true,
"translatorType": 4,
"browserSupport": "gcsibv",
"lastUpdated": "2023-04-24 14:42:56"
"lastUpdated": "2023-08-11 09:54:50"
}

/*
Expand Down Expand Up @@ -736,7 +736,7 @@ function tryOgAuthors(doc) {
var authors = [];
var ogAuthors = ZU.xpath(doc, '//meta[@property="article:author" or @property="video:director" or @property="music:musician"]');
for (var i = 0; i < ogAuthors.length; i++) {
if (ogAuthors[i].content && /(https?:\/\/)?[\da-z.-]+\.[a-z.]{2,6}/.test(ogAuthors[i].content) && ogAuthors[i].content !== "false") {
if (ogAuthors[i].content && !/(https?:\/\/)?[\da-z.-]+\.[a-z.]{2,6}/.test(ogAuthors[i].content) && ogAuthors[i].content !== "false") {
authors.push(ZU.cleanAuthor(ogAuthors[i].content, "author"));
}
}
Expand Down Expand Up @@ -2008,6 +2008,31 @@ var testCases = [
"seeAlso": []
}
]
},
{
"type": "web",
"url": "https://www.nhs.uk/conditions/baby/babys-development/behaviour/separation-anxiety/",
"items": [
{
"itemType": "webpage",
"title": "Separation anxiety",
"creators": [],
"date": "7 Dec 2020, 4:40 p.m.",
"abstractNote": "Separation anxiety is a normal part of your child's development. Find out how to handle the times when your baby or toddler cries or is clingy when you leave them.",
"language": "en",
"url": "https://www.nhs.uk/conditions/baby/babys-development/behaviour/separation-anxiety/",
"websiteTitle": "nhs.uk",
"attachments": [
{
"title": "Snapshot",
"mimeType": "text/html"
}
],
"tags": [],
"notes": [],
"seeAlso": []
}
]
}
]
/** END TEST CASES **/

0 comments on commit 06fed1d

Please sign in to comment.