Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

copy_and_paste: Fix bug where an unlabelled image could be pasted twice.

N-Shar-ma7b7c52b7c9a6
diff --git a/web/src/copy_and_paste.js b/web/src/copy_and_paste.js
index a3908241461..7d3ddf60808 100644
--- a/web/src/copy_and_paste.js
+++ b/web/src/copy_and_paste.js
@@ -419,13 +419,11 @@ export function paste_handler_converter(paste_html) {
// We parse the copied html to then check if the generating link (which, if
// present, always comes before the preview in the copied html) is also there.
- // If the preview has an aria-label, it means it does have a named link in the
- // message, and if the 1st element with the same image link in the copied html
+ // If the 1st element with the same image link in the copied html
// does not have the `message_inline_image` class, it means it is the generating
// link, and not the preview, meaning the generating link is copied as well.
const copied_html = new DOMParser().parseFromString(paste_html, "text/html");
if (
- node.firstChild.hasAttribute("aria-label") &&
!copied_html
.querySelector("a[href='" + node.firstChild.getAttribute("href") + "']")
?.parentNode?.classList.contains("message_inline_image")