Buckets:
| import { RedirectStatusCode } from '../client/components/redirect-status-code' | |
| export const allowedStatusCodes = new Set([301, 302, 303, 307, 308]) | |
| export function getRedirectStatus(route: { | |
| statusCode?: number | |
| permanent?: boolean | |
| }): number { | |
| return ( | |
| route.statusCode || | |
| (route.permanent | |
| ? RedirectStatusCode.PermanentRedirect | |
| : RedirectStatusCode.TemporaryRedirect) | |
| ) | |
| } | |
| // for redirects we restrict matching /_next and for all routes | |
| // we add an optional trailing slash at the end for easier | |
| // configuring between trailingSlash: true/false | |
| export function modifyRouteRegex(regex: string, restrictedPaths?: string[]) { | |
| if (restrictedPaths) { | |
| regex = regex.replace( | |
| /\^/, | |
| `^(?!${restrictedPaths | |
| .map((path) => path.replace(/\//g, '\\/')) | |
| .join('|')})` | |
| ) | |
| } | |
| regex = regex.replace(/\$$/, '(?:\\/)?$') | |
| return regex | |
| } | |
Xet Storage Details
- Size:
- 891 Bytes
- Xet hash:
- 3154cc430058544d69a4ad88de37c9cf87b50669bd2fffc7c72f5dc572d43fe4
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.