diff --git a/apps/client/src/features/page/components/page-import-modal.tsx b/apps/client/src/features/page/components/page-import-modal.tsx index c805edba..2e4b9368 100644 --- a/apps/client/src/features/page/components/page-import-modal.tsx +++ b/apps/client/src/features/page/components/page-import-modal.tsx @@ -34,6 +34,7 @@ import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts"; import { getFileTaskById } from "@/features/file-task/services/file-task-service.ts"; import { queryClient } from "@/main.tsx"; import { useQueryEmit } from "@/features/websocket/use-query-emit.ts"; +import bytes from "bytes"; interface PageImportModalProps { spaceId: string; @@ -100,6 +101,17 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { return; } + const maxSize = getFileImportSizeLimit(); + if (selectedFile.size > maxSize) { + notifications.show({ + color: "red", + message: t("File exceeds the {{limit}} import limit", { + limit: formatBytes(maxSize), + }), + }); + return; + } + try { onClose(); @@ -230,11 +242,26 @@ function ImportFormatSelection({ spaceId, onClose }: ImportFormatSelection) { }, 3000); }, [fileTaskId]); + const maxSingleFileSize = bytes("20mb"); + const handleFileUpload = async (selectedFiles: File[]) => { if (!selectedFiles) { return; } + const oversizedFiles = selectedFiles.filter( + (f) => f.size > maxSingleFileSize, + ); + if (oversizedFiles.length > 0) { + notifications.show({ + color: "red", + message: t("File exceeds the {{limit}} import limit", { + limit: formatBytes(maxSingleFileSize), + }), + }); + return; + } + onClose(); const alert = notifications.show({ diff --git a/apps/server/src/integrations/import/import.controller.ts b/apps/server/src/integrations/import/import.controller.ts index e04e9301..7ee325e5 100644 --- a/apps/server/src/integrations/import/import.controller.ts +++ b/apps/server/src/integrations/import/import.controller.ts @@ -53,7 +53,7 @@ export class ImportController { ) { const validFileExtensions = ['.md', '.html', '.docx']; - const maxFileSize = bytes('10mb'); + const maxFileSize = bytes('20mb'); let file = null; try {