diff --git a/tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-row.tsx b/tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-row.tsx index b447db85..4c14d854 100644 --- a/tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-row.tsx +++ b/tdrive/frontend/src/app/components/file-uploads/pending-root-components/pending-root-row.tsx @@ -33,8 +33,8 @@ const PendingRootRow = ({ const uploadedFilesSize = root.uploadedSize; const uploadProgress = Math.floor((uploadedFilesSize / root.size) * 100); const isUploadCompleted = root.status === 'completed'; - const isFileRoot = root.isUnknownFormat || rootKey.includes('.'); - const fileType = isFileRoot ? rootKey.split('.').pop() : ''; + const isFileRoot = root.isFileRoot; + const fileType = isFileRoot && rootKey.includes('.') ? rootKey.split('.').pop() : ''; // Callback function to open the folder after the upload is completed const handleShowFolder = useCallback(() => { @@ -116,7 +116,10 @@ const PendingRootRow = ({ return rootName; }; - const showFileFolderTestId = !showFolder || isFileRoot ? 'testid:upload-root-modal-row-show-file' : 'testid:upload-root-modal-row-show-folder'; + const showFileFolderTestId = + !showFolder || isFileRoot + ? 'testid:upload-root-modal-row-show-file' + : 'testid:upload-root-modal-row-show-folder'; return (
diff --git a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts index 2d479da4..6d5f3b93 100644 --- a/tdrive/frontend/src/app/features/files/services/file-upload-service.ts +++ b/tdrive/frontend/src/app/features/files/services/file-upload-service.ts @@ -105,8 +105,8 @@ class FileUploadService { this.rootStates.failed[key] = true; } - // Check if the root is a file with unknow format - const isUnknownFormat = + // Check if the root is a file regardless of the file format + const isFileRoot = this.groupedPendingFiles[key]?.length === 1 && this.groupedPendingFiles[key][0].originalFile?.name === key; @@ -142,7 +142,7 @@ class FileUploadService { size: this.rootSizes[key], uploadedSize, status, - isUnknownFormat, + isFileRoot, }; return acc; @@ -253,10 +253,9 @@ class FileUploadService { }, callback: async (filePayload, context) => { const root = filePayload.root; - const isUnknownFormat = + const isFileRoot = this.groupedPendingFiles[root]?.length === 1 && this.groupedPendingFiles[root][0].originalFile?.name === root; - const isFileRoot = isUnknownFormat || filePayload.root.includes('.'); const file = filePayload.file; if (file) { diff --git a/tdrive/frontend/src/app/features/files/state/atoms/root-pending-files-list.ts b/tdrive/frontend/src/app/features/files/state/atoms/root-pending-files-list.ts index aa935828..db719caa 100644 --- a/tdrive/frontend/src/app/features/files/state/atoms/root-pending-files-list.ts +++ b/tdrive/frontend/src/app/features/files/state/atoms/root-pending-files-list.ts @@ -9,7 +9,7 @@ export const RootPendingFilesListState = atom< uploadedSize: number; status: string; items: PendingFileRecoilType[]; - isUnknownFormat: boolean; + isFileRoot: boolean; }; } | undefined diff --git a/tdrive/frontend/src/app/features/files/types/file.ts b/tdrive/frontend/src/app/features/files/types/file.ts index 65218288..0bb1c5ac 100644 --- a/tdrive/frontend/src/app/features/files/types/file.ts +++ b/tdrive/frontend/src/app/features/files/types/file.ts @@ -94,7 +94,7 @@ export type UploadRootType = { uploadedSize: number; status: string; items: PendingFileRecoilType[]; - isUnknownFormat: boolean; + isFileRoot: boolean; }; export type UploadRootListType = {