fix pdf duplicate file upload handler

This commit is contained in:
starmorph
2025-05-20 10:19:08 -07:00
parent 752fd11f27
commit cb2d216973

View File

@@ -23,14 +23,6 @@ export function useFileUpload({
const dropRef = useRef<HTMLDivElement>(null);
const isDuplicate = (file: File, blocks: Base64ContentBlock[]) => {
if (SUPPORTED_FILE_TYPES.includes(file.type)) {
return blocks.some(
(b) =>
b.type === "image" &&
b.metadata?.name === file.name &&
b.mime_type === file.type,
);
}
if (file.type === "application/pdf") {
return blocks.some(
(b) =>
@@ -39,6 +31,14 @@ export function useFileUpload({
b.metadata?.filename === file.name,
);
}
if (SUPPORTED_FILE_TYPES.includes(file.type)) {
return blocks.some(
(b) =>
b.type === "image" &&
b.metadata?.name === file.name &&
b.mime_type === file.type,
);
}
return false;
};