mirror of
https://github.com/ZetaKebab/quartz.git
synced 2025-06-21 16:24:36 +00:00
fix(path): correct handle URI schemes in joinSegments (#1693)
This commit is contained in:
@ -185,8 +185,13 @@ export function slugTag(tag: string) {
|
|||||||
export function joinSegments(...args: string[]): string {
|
export function joinSegments(...args: string[]): string {
|
||||||
return args
|
return args
|
||||||
.filter((segment) => segment !== "")
|
.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("/")
|
.join("/")
|
||||||
.replace(/\/\/+/g, "/")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllSegmentPrefixes(tags: string): string[] {
|
export function getAllSegmentPrefixes(tags: string): string[] {
|
||||||
|
Reference in New Issue
Block a user