From 8d575241fef47bb04e554670831487d427ada3d2 Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 4 Apr 2025 00:00:38 +0200 Subject: [PATCH] Fix lastPathSegment util --- src/lib/util/extract.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/util/extract.ts b/src/lib/util/extract.ts index d1f2990..6ebb4c7 100644 --- a/src/lib/util/extract.ts +++ b/src/lib/util/extract.ts @@ -1,3 +1,6 @@ export function lastPathSegment(path: string): string { - return path.substring(path.lastIndexOf('/')); + while (path.endsWith('/')) { + path = path.slice(0, -1); + } + return path.substring(path.lastIndexOf('/') + 1); }