fix: trim away trailing slash
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
export function removeMultipleSlashes(str: string) {
|
||||
return str.replaceAll(/\/\/+/g, "/")
|
||||
}
|
||||
|
||||
export function removeTrailingSlash(pathname: string) {
|
||||
if (pathname.endsWith("/")) {
|
||||
// Remove the trailing slash
|
||||
return pathname.slice(0, -1)
|
||||
}
|
||||
return pathname
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user