This commit is contained in:
Manav Rathi 2024-04-13 16:50:12 +05:30
parent f7e961e86b
commit ca114a467d
No known key found for this signature in database
4 changed files with 9 additions and 19 deletions

View file

@ -27,7 +27,6 @@ import {
import {
convertCollectionIDExportNameObjectToMap,
convertFileIDExportNameObjectToMap,
getCollectionExportPath,
getCollectionExportedFiles,
getCollectionIDFromFileUID,
getDeletedExportedCollections,
@ -1219,3 +1218,8 @@ class ExportService {
};
}
export default new ExportService();
const getCollectionExportPath = (
exportFolder: string,
collectionExportName: string,
) => `${exportFolder}/${collectionExportName}`;

View file

@ -22,7 +22,6 @@ import {
import { EnteFile } from "types/file";
import { getNonEmptyPersonalCollections } from "utils/collection";
import {
getCollectionExportPath,
getCollectionIDFromFileUID,
getExportRecordFileUID,
getLivePhotoExportName,
@ -433,7 +432,7 @@ async function removeCollectionExportMissingMetadataFolder(
if (
await exportService.exists(
getMetadataFolderExportPath(
getCollectionExportPath(exportDir, collectionExportName),
`${exportDir}/${collectionExportName}`,
),
)
) {

View file

@ -42,10 +42,7 @@ import {
import { EnteFile } from "types/file";
import { SetFilesDownloadProgressAttributes } from "types/gallery";
import { SUB_TYPE, VISIBILITY_STATE } from "types/magicMetadata";
import {
getCollectionExportPath,
getUniqueCollectionExportName,
} from "utils/export";
import { getUniqueCollectionExportName } from "utils/export";
import { downloadFilesWithProgress } from "utils/file";
import { isArchivedCollection, updateMagicMetadata } from "utils/magicMetadata";
@ -176,10 +173,7 @@ async function createCollectionDownloadFolder(
downloadDirPath,
collectionName,
);
const collectionDownloadPath = getCollectionExportPath(
downloadDirPath,
collectionDownloadName,
);
const collectionDownloadPath = `${downloadDirPath}/${collectionDownloadName}`;
await exportService.checkExistsAndCreateDir(collectionDownloadPath);
return collectionDownloadPath;
}

View file

@ -200,9 +200,7 @@ export const getUniqueCollectionExportName = async (
let collectionExportName = sanitizeName(collectionName);
let count = 1;
while (
(await exportService.exists(
getCollectionExportPath(dir, collectionExportName),
)) ||
(await exportService.exists(`${dir}/${collectionExportName}`)) ||
collectionExportName === ENTE_TRASH_FOLDER
) {
collectionExportName = `${sanitizeName(collectionName)}(${count})`;
@ -241,11 +239,6 @@ export const getFileMetadataExportPath = (
fileExportName: string,
) => `${collectionExportPath}/${ENTE_METADATA_FOLDER}/${fileExportName}.json`;
export const getCollectionExportPath = (
exportFolder: string,
collectionExportName: string,
) => `${exportFolder}/${collectionExportName}`;
export const getFileExportPath = (
collectionExportPath: string,
fileExportName: string,