Skip to content
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: correct path handling for file name extraction in rss.js #7005

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lumirlumir
Copy link

@lumirlumir lumirlumir commented Jul 1, 2024

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:

  • 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.

Copy link

vercel bot commented Jul 1, 2024

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

Copy link

github-actions bot commented Jul 1, 2024

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! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants