c9492a8cc9
It should be enough to encode the characters that `path-to-regexp` uses as path delimiters (`/#?`). Fixes https://github.com/vercel/next.js/issues/14691
4 lines
197 B
TypeScript
4 lines
197 B
TypeScript
// escape delimiters used by path-to-regexp
|
|
export default function escapePathDelimiters(segment: string): string {
|
|
return segment.replace(/[/#?]/g, (char: string) => encodeURIComponent(char))
|
|
}
|