mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-14 21:50:56 -05:00
44eca312ff
PDF Detach Misc Tests GitOrigin-RevId: 9615c8fdfd8964a9c63d7c91e4596d397a1d35dc
11 lines
287 B
JavaScript
11 lines
287 B
JavaScript
export function buildUrlWithDetachRole(mode) {
|
|
const url = new URL(window.location)
|
|
let cleanPathname = url.pathname
|
|
.replace(/\/(detached|detacher)\/?$/, '')
|
|
.replace(/\/$/, '')
|
|
if (mode) {
|
|
cleanPathname += `/${mode}`
|
|
}
|
|
url.pathname = cleanPathname
|
|
return url
|
|
}
|