From 1ceb27dea821c2f5b7cbb8589ee7d56873b3ccd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sat, 10 Jan 2026 01:08:04 +0100 Subject: [PATCH] Improve folder path construction logic to handle root and parent paths correctly --- b0esche_cloud/lib/services/file_service.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/b0esche_cloud/lib/services/file_service.dart b/b0esche_cloud/lib/services/file_service.dart index 606b3b4..ee5f88e 100644 --- a/b0esche_cloud/lib/services/file_service.dart +++ b/b0esche_cloud/lib/services/file_service.dart @@ -119,9 +119,18 @@ class FileService { String parentPath, String folderName, ) async { - // Normalize parent path and construct new folder path - final normalizedParent = parentPath == '/' ? '' : parentPath; - final path = '$normalizedParent/$folderName'; + // Construct proper path: /parent/folder or /folder for root + String path; + if (parentPath == '/') { + path = '/$folderName'; + } else { + // Ensure parentPath doesn't end with / before appending + final cleanParent = parentPath.endsWith('/') + ? parentPath.substring(0, parentPath.length - 1) + : parentPath; + path = '$cleanParent/$folderName'; + } + final data = { 'name': folderName, 'path': path,