uploaded_files_list: Fix id pollution.

The HTML id attribute is supposed to be globally unique; it’s not an
appropriate place to store a user-controlled string, or to identify
part of a component that’s rendered more than once.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2024-09-30 13:16:33 -07:00
committed by Tim Abbott
parent 762617e23f
commit b0653d1ea4
3 changed files with 4 additions and 4 deletions

View File

@@ -184,7 +184,7 @@ export function set_up_attachments(): void {
});
$("#uploaded_files_table").on("click", ".remove-attachment", (e) => {
const file_name = $(e.target).closest(".uploaded_file_row").attr("id");
const file_name = $(e.target).closest(".uploaded_file_row").attr("data-attachment-name");
delete_attachments(
$(e.target).closest(".uploaded_file_row").attr("data-attachment-id")!,
file_name!,