fix(proxy): handle missing locale correctly for /dashboard redirects#313
Conversation
✅ Deploy Preview for develop-devlovers ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughExpands frontend environment configuration with new variables across core, OAuth, Cloudinary, Stripe, admin, quiz, Telegram, and Gmail sections, plus rate-limiting and security controls. Refactors locale resolution in proxy.ts to use a dedicated helper function instead of hardcoded defaults. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@frontend/.env.example`:
- Line 105: Add a trailing newline to the file so it ends with a newline
character; specifically update the .env.example so the final line
"GROQ_API_KEY=" is followed by a blank line (newline at EOF) to satisfy POSIX
tooling and static analysis.
🧹 Nitpick comments (1)
frontend/proxy.ts (1)
88-89: Remaining hardcoded locale references reduce the benefit of this refactor.Line 89 hardcodes
'/en'for the root redirect instead of usingdefaultLocale. Lines 68 and 81–82 (pre-existing) still use a hardcoded/(uk|en|pl)regex. Consider making these consistent with the new centralized approach so that adding or removing a locale ini18n/config.tsdoesn't require touching multiple places.At minimum, the root redirect is a quick win:
Suggested fix for line 89
- return NextResponse.redirect(new URL('/en', req.url)); + return NextResponse.redirect(new URL(`/${defaultLocale}`, req.url));For the regex on lines 68 and 81–82, you could build it dynamically:
const localePattern = new RegExp(`^\\/(${locales.join('|')})(?=\\/|$)`);Also applies to: 92-92
|
|
||
| UPSTASH_REDIS_REST_URL= | ||
| UPSTASH_REDIS_REST_TOKEN= | ||
| GROQ_API_KEY= No newline at end of file |
There was a problem hiding this comment.
Missing trailing newline.
Static analysis flags no blank line at end of file. Most tools and POSIX convention expect a trailing newline.
GROQ_API_KEY=
+📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| GROQ_API_KEY= | |
| GROQ_API_KEY= | |
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 105-105: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
🤖 Prompt for AI Agents
In `@frontend/.env.example` at line 105, Add a trailing newline to the file so it
ends with a newline character; specifically update the .env.example so the final
line "GROQ_API_KEY=" is followed by a blank line (newline at EOF) to satisfy
POSIX tooling and static analysis.
Summary by CodeRabbit
Release Notes