Skip to content

Commit 7e8683a

Browse files
authored
fix(slack): better file handling (#276)
1 parent 1c01d51 commit 7e8683a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/slack/src/message.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,14 @@ export const extractMessagesMetadata = async <
631631
const text = await response.text();
632632
throw new Error(text);
633633
}
634-
if (response.headers.get("content-type") !== file.mimetype) {
634+
const responseContentType = response.headers
635+
.get("content-type")
636+
?.split(";")[0]
637+
?.trim();
638+
if (
639+
!responseContentType ||
640+
!supportedFileTypes.includes(responseContentType)
641+
) {
635642
throw new Error(
636643
`The file ${file.name} mime type returned by the server was ${response.headers.get("content-type")}.`
637644
);

0 commit comments

Comments
 (0)