Unverified Commit eef8f1f3 authored by Kiarash Zarinmehr's avatar Kiarash Zarinmehr Committed by GitHub

Improve Server Lib Utilities (#12119)

parent 91adb866
...@@ -5,7 +5,7 @@ export function normalizePagePath(page: string): string { ...@@ -5,7 +5,7 @@ export function normalizePagePath(page: string): string {
page = '/index' page = '/index'
} }
// Resolve on anything that doesn't start with `/` // Resolve on anything that doesn't start with `/`
if (page[0] !== '/') { if (!page.startsWith('/')) {
page = `/${page}` page = `/${page}`
} }
// Throw when using ../ etc in the pathname // Throw when using ../ etc in the pathname
......
import { BLOCKED_PAGES } from '../lib/constants' import { BLOCKED_PAGES } from '../lib/constants'
export function isBlockedPage(pathname: string): boolean { export function isBlockedPage(pathname: string): boolean {
return BLOCKED_PAGES.indexOf(pathname) !== -1 return BLOCKED_PAGES.includes(pathname)
} }
export function cleanAmpPath(pathname: string): string { export function cleanAmpPath(pathname: string): string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment