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