Unverified Commit 785f4c23 authored by Josh Story's avatar Josh Story Committed by GitHub

[lts-maintenance] Match Next data paths case-sensitively (#197)

parent 7217d63d
import { matchNextDataPathname } from './match-next-data-pathname'
describe('matchNextDataPathname', () => {
it('matches the exact internal route', () => {
expect(matchNextDataPathname('/_next/data/build-id/index.json')).toEqual({
path: ['build-id', 'index.json'],
})
})
it.each([
'/_NEXT/data/build-id/index.json',
'/_next/DATA/build-id/index.json',
'/_NeXt/DaTa/build-id/index.json',
])('does not match a case variant: %s', (pathname) => {
expect(matchNextDataPathname(pathname)).toBe(false)
})
})
import { getPathMatch } from '../../shared/lib/router/utils/path-match' import { getPathMatch } from '../../shared/lib/router/utils/path-match'
const matcher = getPathMatch('/_next/data/:path*') const matcher = getPathMatch('/_next/data/:path*', { sensitive: true })
export function matchNextDataPathname(pathname: string | null | undefined) { export function matchNextDataPathname(pathname: string | null | undefined) {
if (typeof pathname !== 'string') return false if (typeof pathname !== 'string') return false
......
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