Skip to content

Commit

Permalink
web/satellite: use original un-unique file name
Browse files Browse the repository at this point in the history
This change removes the code that found a unique name for a file whose
name already existed, appending a number in parentheses in that case.
This is being removed because of object versioning.

Change-Id: Ief5ea160be4ddaf639b49e9fe718bb7520508285
  • Loading branch information
wilfred-asomanii authored and Storj Robot committed Apr 16, 2024
1 parent 71e2770 commit a01e62e
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions web/satellite/src/store/modules/objectBrowserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,25 +478,9 @@ export const useObjectBrowserStore = defineStore('objectBrowser', () => {
)
.filter(isFileSystemEntry) as FileSystemEntry[];

const fileNames = state.files.map((file) => file.Key);

function getUniqueFileName(fileName: string): string {
for (let count = 1; fileNames.includes(fileName); count++) {
if (count > 1) {
fileName = fileName.replace(/\((\d+)\)(.*)/, `(${count})$2`);
} else {
fileName = fileName.replace(/([^.]*)(.*)/, `$1 (${count})$2`);
}
}

return fileName;
}

for await (const { path, file } of traverse(iterator)) {
const directories = path.split('/');
directories[0] = getUniqueFileName(directories[0]);

const fileName = getUniqueFileName(directories.join('/') + file.name);
const fileName = directories.join('/') + file.name;
const key = state.path + fileName;

await enqueueUpload(key, file);
Expand Down

0 comments on commit a01e62e

Please sign in to comment.