فهرست منبع

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>

gittihub-jpg 3 ماه پیش
والد
کامیت
88b7cd8e96
1فایلهای تغییر یافته به همراه1 افزوده شده و 3 حذف شده
  1. 1 3
      js/privatebin.js

+ 1 - 3
js/privatebin.js

@@ -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