react.dev
react.dev copied to clipboard
fix: correct path handling for file name extraction in `rss.js`
fix: correct path handling for file name extraction in rss.js
Hello😊 Thank you for your attention to this matter :)
1. Description
This PR addresses an issue with path handling in rss.js. This makes it impossible for Windows users to run dev server through yarn dev.
The problem was identified when the generateRssFeed method failed to exclude the index.md file correctly, causing errors due to missing metadata fields required for RSS feeds.
2. Solution
The solution is to use the path.basename method, which correctly extracts the file name from a path regardless of the operating system's path separator(/ or \). Here are the key changes made:
- Previous method
const id = filePath.split('/').slice(-1).join('');
- Improved method
const id = path.basename(filePath);
This ensures that the file name is accurately extracted, and the index.md file is correctly excluded from the RSS feed generation process.
3. Conclusion
This PR fixes the path handling issues, ensuring compatibility across different operating systems(Windows or Linux/Mac) by using the appropriate methods for file name extraction and path manipulation.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| 19-react-dev | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 1, 2024 5:00am |
| react-dev | ✅ Ready (Inspect) | Visit Preview | Jul 1, 2024 5:00am |
Size changes
📦 Next.js Bundle Analysis for react-dev
This analysis was generated by the Next.js Bundle Analysis action. 🤖
This PR introduced no changes to the JavaScript bundle! 🙌
Closing this as stale; it looks like it won’t be fixed.