mirror of
https://gitlab.com/MisterBiggs/brain-quartz.git
synced 2025-06-16 01:36:40 +00:00
fix(path): correct handle URI schemes in joinSegments (#1693)
This commit is contained in:
parent
a934397961
commit
9466c145b1
@ -185,8 +185,13 @@ export function slugTag(tag: string) {
|
||||
export function joinSegments(...args: string[]): string {
|
||||
return args
|
||||
.filter((segment) => segment !== "")
|
||||
.map((segment, index) =>
|
||||
index === 0
|
||||
? // Deduplicate but not remove leading slashes for first segment
|
||||
segment.replace(/\/+$/g, "").replace(/^\/\/+/g, "/")
|
||||
: segment.replace(/^\/+|\/+$/g, ""),
|
||||
)
|
||||
.join("/")
|
||||
.replace(/\/\/+/g, "/")
|
||||
}
|
||||
|
||||
export function getAllSegmentPrefixes(tags: string): string[] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user