2019-04-24 16:47:50 +02:00
|
|
|
export function rewriteUrlForNextExport(url: string): string {
|
|
|
|
const [pathname, hash] = url.split('#')
|
|
|
|
// tslint:disable-next-line
|
|
|
|
let [path, qs] = pathname.split('?')
|
2020-01-08 17:45:17 +01:00
|
|
|
if (path) {
|
|
|
|
path = path.replace(/\/$/, '')
|
|
|
|
// Append a trailing slash if this path does not have an extension
|
|
|
|
if (!/\.[^/]+\/?$/.test(path)) path += `/`
|
|
|
|
}
|
2020-06-07 19:15:06 +02:00
|
|
|
if (typeof qs === 'string') path += '?' + qs
|
|
|
|
if (typeof hash === 'string') path += '#' + hash
|
2019-04-24 16:47:50 +02:00
|
|
|
return path
|
|
|
|
}
|