1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

fix(server/files): duplicate entry when making a nested folder (#3813)

This commit is contained in:
Mrxbox98 2022-01-18 11:49:06 -08:00 committed by GitHub
parent 5f308feb3f
commit 1f3217c3c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,8 +22,8 @@ import { FileActionCheckbox } from '@/components/server/files/SelectFileCheckbox
import { hashToPath } from '@/helpers';
const sortFiles = (files: FileObject[]): FileObject[] => {
return files.sort((a, b) => a.name.localeCompare(b.name))
.sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
const sortedFiles: FileObject[] = files.sort((a, b) => a.name.localeCompare(b.name)).sort((a, b) => a.isFile === b.isFile ? 0 : (a.isFile ? 1 : -1));
return sortedFiles.filter((file, index) => index === 0 || file.name !== sortedFiles[index - 1].name);
};
export default () => {