Skip to content

Commit 1f3217c

Browse files
authored
fix(server/files): duplicate entry when making a nested folder (pterodactyl#3813)
1 parent 5f308fe commit 1f3217c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

resources/scripts/components/server/files/FileManagerContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { FileActionCheckbox } from '@/components/server/files/SelectFileCheckbox
2222
import { hashToPath } from '@/helpers';
2323

2424
const sortFiles = (files: FileObject[]): FileObject[] => {
25-
return files.sort((a, b) => a.name.localeCompare(b.name))
26-
.sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
25+
const sortedFiles: FileObject[] = files.sort((a, b) => a.name.localeCompare(b.name)).sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
26+
return sortedFiles.filter((file, index) => index === 0 || file.name !== sortedFiles[index - 1].name);
2727
};
2828

2929
export default () => {

0 commit comments

Comments
 (0)