fedimbed: dont wrap anchors in masked link if body is equal to href

This commit is contained in:
Cynthia Foxwell 2024-01-12 18:02:39 -07:00
parent a5ee7d3f44
commit 91b351fe73

View file

@ -633,7 +633,7 @@ async function processUrl(msg, url, spoiler = false) {
// FIXME: stop being lazy and use an html parser
content = content.replace(
/<a .*?href="([^"]+?)".*?>(.+?)<\/a>/gi,
"[$2]($1)"
(_, url, text) => (url === text ? url : `[${text}](${url})`)
);
content = content.replace(
/<img .*?src="([^"]+?)".*?(alt|title)="([^"]+?)".*?\/>/gi,