mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
fix: handle root path in breadcrumb parsing for PathInput component
- Added logic to correctly parse and return the root path for Unix-like systems in the breadcrumb segment function.
This commit is contained in:
@@ -22,6 +22,11 @@ interface BreadcrumbSegment {
|
|||||||
function parseBreadcrumbs(path: string): BreadcrumbSegment[] {
|
function parseBreadcrumbs(path: string): BreadcrumbSegment[] {
|
||||||
if (!path) return [];
|
if (!path) return [];
|
||||||
|
|
||||||
|
// Handle root path on Unix-like systems
|
||||||
|
if (path === '/') {
|
||||||
|
return [{ name: '/', path: '/', isLast: true }];
|
||||||
|
}
|
||||||
|
|
||||||
const segments = path.split(/[/\\]/).filter(Boolean);
|
const segments = path.split(/[/\\]/).filter(Boolean);
|
||||||
const isWindows = segments[0]?.includes(':');
|
const isWindows = segments[0]?.includes(':');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user