diff --git a/js/privatebin.js b/js/privatebin.js index a03a5111..7a2932cd 100644 --- a/js/privatebin.js +++ b/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