feat: upload - deel 03

This commit is contained in:
kodi
2026-03-13 16:41:04 +01:00
parent b635a79b63
commit 0591db4b2f
5 changed files with 36 additions and 9 deletions
+13 -2
View File
@@ -213,6 +213,17 @@
return idx >= 0 ? normalized.slice(idx + 1) : normalized;
}
function compareModalFilesByName(a, b) {
const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: "base" });
const aName = (a && (a.name || basename(a.relative_path || a.path || ""))) || "";
const bName = (b && (b.name || basename(b.relative_path || b.path || ""))) || "";
const byName = collator.compare(aName, bName);
if (byName !== 0) return byName;
const aPath = (a && (a.relative_path || a.path || "")) || "";
const bPath = (b && (b.relative_path || b.path || "")) || "";
return collator.compare(aPath, bPath);
}
function fallbackText(value) {
const text = (value || "").toString().trim();
return text || "-";
@@ -890,7 +901,7 @@
const visible = (state.modalFiles || []).filter((file) => {
const text = `${file.relative_path || ""} ${file.name || ""}`.toLowerCase();
return !filter || text.includes(filter);
});
}).sort(compareModalFilesByName);
state.modalVisibleFiles = visible;
el.modalFilesList.innerHTML = "";
@@ -966,7 +977,7 @@
const recursive = el.modalRecursiveInput.checked ? "true" : "false";
const data = await api(
`/api/files/discover?root_id=${encodeURIComponent(rootId)}&subpath=${encodeURIComponent(chosenSubpath)}&recursive=${recursive}&limit=200`
`/api/files/discover?root_id=${encodeURIComponent(rootId)}&subpath=${encodeURIComponent(chosenSubpath)}&recursive=${recursive}&limit=1000`
);
state.modalSelectionAnchorPath = null;
state.modalFiles = data.items || [];