Update js/privatebin.js

Thanks, updated this to avoid relying on `Array.isArray()` for the `FileList` case and to always set `attachment_name` to an array.

Co-authored-by: Mikhail Romanov <42250412+Ribas160@users.noreply.github.com>
This commit is contained in:
gittihub-jpg 2026-04-29 10:04:22 +02:00 committed by GitHub
parent 8a7f7a60a5
commit 88b7cd8e96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5230,9 +5230,7 @@ jQuery.PrivateBin = (function($) {
};
if (attachmentsData.length) {
cipherMessage['attachment'] = attachmentsData;
const fileNames = AttachmentViewer.getFiles();
if (fileNames && Array.isArray(fileNames)) {
cipherMessage['attachment_name'] = fileNames.map((fileInfo => fileInfo.name));
cipherMessage['attachment_name'] = AttachmentViewer.getFiles()?.map((fileInfo => fileInfo.name)) ?? [];
}
} else if (AttachmentViewer.hasAttachment()) {
// fall back to cloned part