feat: support uploading folders via drag-and-drop and toolbar button

This commit is contained in:
Linus Rath
2026-03-21 20:45:14 +01:00
parent 45a485a1fa
commit 0d28d811a8
12 changed files with 179 additions and 23 deletions
+3 -2
View File
@@ -371,10 +371,11 @@ export const useFileStore = create<FileState>((set, get) => ({
}
// Create directories as flat entries with prefixed names (no parentId nesting)
// Convert "/" separators from webkitRelativePath to PATH_SEP () for server names
const sortedDirs = [...dirs].sort((a, b) => a.split('/').length - b.split('/').length);
for (const dir of sortedDirs) {
if (abortController.signal.aborted) break;
const fullDirName = prefix + dir;
const fullDirName = prefix + dir.replace(/\//g, PATH_SEP);
try {
await client.createFileDirectory(fullDirName, null);
} catch {
@@ -387,7 +388,7 @@ export const useFileStore = create<FileState>((set, get) => ({
if (abortController.signal.aborted) break;
const file = files[i];
const relativePath = (file as File & { webkitRelativePath?: string }).webkitRelativePath || file.name;
const fullName = prefix + relativePath;
const fullName = prefix + relativePath.replace(/\//g, PATH_SEP);
set({ uploadProgress: { name: relativePath, loaded: 0, total: file.size, current: i + 1, totalFiles } });