Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ interface IAddAttachParams {
description: string | object;
context?: any;
bufferFormat?: string;
fileCustomName?: string;
}

type TAttachObject = {
Expand All @@ -43,6 +44,7 @@ export const addAttach = async ({
description: descriptionRaw,
context,
bufferFormat = 'jpg',
fileCustomName,
}: IAddAttachParams) => {
const description = getSerializableContent(descriptionRaw);

Expand All @@ -55,7 +57,11 @@ export const addAttach = async ({
return;
}
const createTime = Date.now();
const fileName = generateRandomString();
var fileName;
if (!fileCustomName)
fileName = generateRandomString();
else
fileName = fileCustomName;
if (typeof attach === 'string') {
const attachObject: TAttachObject = {
createTime,
Expand Down