From 2b12319b63c4eaa8874cf90dbe4a780b90e132b1 Mon Sep 17 00:00:00 2001
From: FineArchs <133759614+FineArchs@users.noreply.github.com>
Date: Thu, 22 Aug 2024 11:56:08 +0900
Subject: [PATCH] Update extract-url-from-mfm.ts

---
 packages/frontend/src/scripts/extract-url-from-mfm.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/packages/frontend/src/scripts/extract-url-from-mfm.ts b/packages/frontend/src/scripts/extract-url-from-mfm.ts
index d5654ba850..23c689782a 100644
--- a/packages/frontend/src/scripts/extract-url-from-mfm.ts
+++ b/packages/frontend/src/scripts/extract-url-from-mfm.ts
@@ -11,8 +11,11 @@ import { unique } from '@/scripts/array.js';
 const removeHash = (x: string) => x.replace(/#[^#]*$/, '');
 
 export function extractUrlFromMfm(nodes: mfm.MfmNode[], respectSilentFlag = true): string[] {
+	const quotedUrlNodes = mfm.extract(nodes, (node) => {
+		return (node.type === 'quote') && (node.children.length === 1) && (node.children[0].type === 'url');
+	}).map(quote => quote.children[0]);
 	const urlNodes = mfm.extract(nodes, (node) => {
-		return (node.type === 'url') || (node.type === 'link' && (!respectSilentFlag || !node.props.silent));
+		return (node.type === 'url' && !quotedUrlNodes.includes(node)) || (node.type === 'link' && (!respectSilentFlag || !node.props.silent));
 	});
 	const urls: string[] = unique(urlNodes.map(x => x.props.url));