Fix docs routing for forc.pub packages#94
Conversation
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on November 7. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull Request Overview
This PR improves error handling, security validation, and documentation rendering in the application. The changes focus on better byte-code conversion, enhanced package name validation, and improved user experience when viewing documentation links.
- Refactored byte-code content conversion to use proper TextDecoder for safer UTF-8 decoding
- Enhanced package name validation with regex pattern and additional security checks
- Added PackageNotFoundError for better 404 error handling across API calls
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/features/docs/lib/utils.ts | Improved byte-code conversion with filtering and TextDecoder |
| app/src/features/docs/lib/security.ts | Enhanced package name validation with regex pattern |
| app/src/features/docs/lib/api.ts | Added PackageNotFoundError class and 404 handling in API functions |
| app/src/features/detail/components/PackageSidebar.tsx | Improved docs link display with full URL and better fallback text |
| app/src/constants.ts | Refactored API URL resolution with multiple fallback options |
| app/src/app/docs/[...path]/route.ts | Integrated new error handling, byte-code conversion, and path resolution logic |
| app/next.config.mjs | Enhanced environment variable configuration with VERCEL_URL support |
Comments suppressed due to low confidence (1)
app/src/app/docs/[...path]/route.ts:1
- The template literal uses single quotes instead of backticks, preventing variable interpolation. The
packageNamevariable will not be substituted with its actual value. This line should use backticks for proper template literal interpolation or be constructed differently to access the outer scope variable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ensure the frontend and docs route target the deployed API, normalize package-name handling, and serve documentation assets from their actual paths. Improves IPFS tarball decoding and logging so future doc publishes validate end-to-end.