rsnext/packages/next/next-server/server/utils.ts
Tim Neutkens b8d075ef0e
Update environment support (#11524)
* Remove req.env

* Rename NEXT_APP_ to NEXT_PUBLIC_

* Remove key exposing env config

* Update tests

* Update NEXT_APP_ test to NEXT_PUBLIC_
2020-03-31 17:53:50 +02:00

16 lines
503 B
TypeScript

import { BLOCKED_PAGES } from '../lib/constants'
export function isBlockedPage(pathname: string): boolean {
return BLOCKED_PAGES.indexOf(pathname) !== -1
}
export function cleanAmpPath(pathname: string): string {
if (pathname.match(/\?amp=(y|yes|true|1)/)) {
pathname = pathname.replace(/\?amp=(y|yes|true|1)&?/, '?')
}
if (pathname.match(/&amp=(y|yes|true|1)/)) {
pathname = pathname.replace(/&amp=(y|yes|true|1)/, '')
}
pathname = pathname.replace(/\?$/, '')
return pathname
}