fix(messagepayload): resolveFile property names (#7458)

This commit is contained in:
muchnameless
2022-02-15 18:32:03 +01:00
committed by GitHub
parent 32985109c3
commit a8106f7c58

View File

@@ -228,7 +228,7 @@ class MessagePayload {
*/ */
static async resolveFile(fileLike) { static async resolveFile(fileLike) {
let attachment; let attachment;
let fileName; let name;
const findName = thing => { const findName = thing => {
if (typeof thing === 'string') { if (typeof thing === 'string') {
@@ -246,14 +246,14 @@ class MessagePayload {
typeof fileLike === 'string' || fileLike instanceof Buffer || typeof fileLike.pipe === 'function'; typeof fileLike === 'string' || fileLike instanceof Buffer || typeof fileLike.pipe === 'function';
if (ownAttachment) { if (ownAttachment) {
attachment = fileLike; attachment = fileLike;
fileName = findName(attachment); name = findName(attachment);
} else { } else {
attachment = fileLike.attachment; attachment = fileLike.attachment;
fileName = fileLike.name ?? findName(attachment); name = fileLike.name ?? findName(attachment);
} }
const fileData = await DataResolver.resolveFile(attachment); const data = await DataResolver.resolveFile(attachment);
return { fileData, fileName }; return { data, name };
} }
/** /**