Skip to content

Commit

Permalink
Fix: slack message filesize
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraggle committed Dec 10, 2024
1 parent 3500423 commit ed846eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions connectors/src/connectors/slack/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,13 +801,16 @@ async function makeContentFragment(
const contentType = "text/vnd.dust.attachment.slack.thread";
const fileName = `slack_thread-${channel.channel.name}-${threadTs}.txt`;

const blob = new Blob([section]);
const fileSize = blob.size;

const fileRes = await dustAPI.uploadFile({
contentType,
fileName,
fileSize: section.length,
fileSize: fileSize,
useCase: "conversation",
useCaseMetadata: conversationId ? { conversationId } : undefined,
fileObject: new File([section], fileName, { type: contentType }),
fileObject: new File([blob], fileName, { type: contentType }),
});

if (fileRes.isErr()) {
Expand Down
3 changes: 2 additions & 1 deletion front/lib/api/files/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export const parseUploadRequest = async (
return new Err({
name: "dust_error",
code: "file_too_large",
message: "File is too large.",
message:
"File is too large or the size passed to the File instance in the DB does not match the size of the uploaded file.",
});
}
// entire message: options.allowEmptyFiles is false, file size should be greater than 0
Expand Down

0 comments on commit ed846eb

Please sign in to comment.