-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(nextra): allow to contain dots in page filenames #546
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
packages/nextra/src/locales.ts
Outdated
const PUBLIC_FILE = /\.(.*)$/ | ||
|
||
export function locales(request: NextRequest) { | ||
const { nextUrl } = request | ||
|
||
const shouldHandleLocale = | ||
!PUBLIC_FILE.test(nextUrl.pathname) && | ||
!nextUrl.pathname.includes('/api/') && | ||
!nextUrl.pathname.includes('/_next/') && | ||
!/^\/(api|_next)\//.test(nextUrl.pathname) && | ||
!/\.(jpe?g|svg|png|webmanifest)$/.test(nextUrl.pathname) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pageMaps: PageMapItem[], | ||
pageMap: PageMapItem[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
export const parseJsonFile = ( | ||
content: string, | ||
path: string | ||
) => Record<string, any> = (content: string, path: string) => { | ||
): Record<string, any> => { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be simplified
🦋 Changeset detectedLatest commit: ba954cf The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Great refactor, thanks! |
* fix(nextra): allow to contain dots in page filenames * add changeset
fixes #545
getLocaleFromFilename
,removeExtension
andgetFileName
in favor of simple and more genericparseFileName
functionparseFileName
to ensure it works like expectedlocales.ts
,const PUBLIC_FILE = /\.(.*)$/
not allow redirect page names with dots