fix: trailing slash integration url issues (#1571)
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import type { ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapters/headers";
|
||||
|
||||
export const appendPath = (url: URL | string, path: string) => {
|
||||
const newUrl = new URL(url);
|
||||
newUrl.pathname = removeTrailingSlash(newUrl.pathname) + path;
|
||||
return newUrl;
|
||||
};
|
||||
|
||||
const removeTrailingSlash = (path: string) => {
|
||||
export const removeTrailingSlash = (path: string) => {
|
||||
return path.at(-1) === "/" ? path.substring(0, path.length - 1) : path;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user