diff --git a/src/app/folder-viewer/page.tsx b/src/app/folder-viewer/page.tsx index 8e83bfc..58b9776 100644 --- a/src/app/folder-viewer/page.tsx +++ b/src/app/folder-viewer/page.tsx @@ -174,12 +174,18 @@ const FolderViewerPage = () => { // Don't allow navigation above library root if (currentPath === libraryRoot) return ''; - const pathParts = currentPath.split('/').filter(part => part.length > 0); + // Split path but keep leading slash for absolute paths + const pathParts = currentPath.split('/'); const libraryParts = libraryRoot.split('/').filter(part => part.length > 0); - if (pathParts.length <= libraryParts.length) return ''; + // Filter out empty parts but keep structure + const filteredPathParts = pathParts.filter(part => part.length > 0); - return pathParts.slice(0, -1).join('/'); + if (filteredPathParts.length <= libraryParts.length) return ''; + + // Reconstruct absolute path + const parentParts = filteredPathParts.slice(0, -1); + return '/' + parentParts.join('/'); }; const handleBackClick = () => {