Enable numeric sorting on file list

This commit is contained in:
2024-03-01 00:08:06 +01:00
parent 66152fc646
commit b2df010081
3 changed files with 4 additions and 5 deletions

View File

@@ -184,7 +184,7 @@ const sort_children = children => {
if (a.type !== b.type) { if (a.type !== b.type) {
return a.type === "dir" ? -1 : 1 return a.type === "dir" ? -1 : 1
} }
return a.name.localeCompare(b.name, "default", {numeric: true}) return a.name.localeCompare(b.name, undefined, {numeric: true})
}) })
} }

View File

@@ -9,8 +9,7 @@
// //
// on_error is called when the upload has failed. The parameters are the error // on_error is called when the upload has failed. The parameters are the error
import { fs_get_node, fs_mkdirall } from "../FilesystemAPI" import { fs_path_url } from "../FilesystemUtil"
import { fs_path_url, fs_split_path } from "../FilesystemUtil"
// code and an error message // code and an error message
export const upload_file = async (file, path, on_progress, on_success, on_error) => { export const upload_file = async (file, path, on_progress, on_success, on_error) => {

View File

@@ -160,9 +160,9 @@ const sortBy = (field) => {
} }
} else { } else {
if (currentSortAscending) { if (currentSortAscending) {
return fieldA.localeCompare(fieldB) return fieldA.localeCompare(fieldB, undefined, {numeric: true})
} else { } else {
return fieldB.localeCompare(fieldA) return fieldB.localeCompare(fieldA, undefined, {numeric: true})
} }
} }
}) })