reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
11k stars 7.51k forks source link

fix: correct path handling for file name extraction in `rss.js` #7005

Open lumirlumir opened 3 months ago

lumirlumir commented 3 months ago

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.

image image

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:

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.

vercel[bot] commented 3 months ago

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
github-actions[bot] commented 3 months ago

Size changes

## 📦 Next.js Bundle Analysis for react-dev This analysis was generated by the [Next.js Bundle Analysis action](https://github.com/hashicorp/nextjs-bundle-analysis). 🤖 This PR introduced no changes to the JavaScript bundle! 🙌