- Notifications
You must be signed in to change notification settings - Fork 35
fix: should handle ./ relative path#109
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
bytemain commented May 21, 2025 • edited by coderabbitai bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by coderabbitai bot
Uh oh!
There was an error while loading. Please reload this page.
coderabbitaibot commented May 21, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
WalkthroughA new Changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
test/utils.test.jsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-eggache". (The package "eslint-plugin-eggache" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-eggache" was referenced from the config file in ".eslintrc » eslint-config-egg". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. lib/utils.jsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-eggache". (The package "eslint-plugin-eggache" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: The plugin "eslint-plugin-eggache" was referenced from the config file in ".eslintrc » eslint-config-egg". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
lib/utils.js (1)
193-193: Consider consolidating path normalization logic.There's currently duplicate logic for handling backslashes in both line 193 (explicit replacement) and in the new
normalizePathfunction (for Windows). Consider moving all path normalization intonormalizePathfor better maintainability.// use / instead of \\ -if (fileName.indexOf('\\') !== -1) fileName = fileName.replace(/\\+/g, '/');+// Backslash normalization will be handled by normalizePath // fix absolute path // /foo => foo if (fileName[0] === '/') fileName = fileName.replace(/^\/+/, ''); // fix case // ./foo/bar => foo/bar if (fileName){fileName = normalizePath(fileName)}Also applies to: 199-203
test/utils.test.js (1)
56-58: Consider adding more complex path combination tests.While the current tests cover the basic
./scenarios, consider adding tests with more complex combinations like./foo/../barto ensure that all edge cases are properly handled by the normalization logic.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
lib/utils.js(2 hunks)test/utils.test.js(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Node.js / Test (windows-latest, 16)
- GitHub Check: Node.js / Test (windows-latest, 18)
- GitHub Check: Node.js / Test (windows-latest, 14)
🔇 Additional comments (3)
lib/utils.js (2)
171-176: Good addition of thenormalizePathfunction.This helper function correctly normalizes file paths by using
path.normalizeand handles Windows backslashes properly. This abstraction will make path handling more consistent throughout the codebase.
199-203: Well implemented fix for handling./relative paths.The changes correctly address the issue described in the PR objectives by ensuring that paths prefixed with
./are properly normalized before stripping occurs. This allowsstripFileName(1, './foo/bar')to correctly returnbarinstead offoo/bar.test/utils.test.js (1)
56-58: Good test coverage for the new functionality.These test cases properly validate the new behavior for handling paths prefixed with
./, including both normalization (when strip=0) and directory level stripping (when strip=1). The third test case specifically verifies the fix described in the PR objectives.
bytemain commented May 21, 2025
The failure of CI doesn't seem to be related to this fix. I don't have the permission to rerun the CI. Can you help me retry it? |
fengmk2 commented May 22, 2025
@bytemain sure, also invite you to join node-modules owner team :) |
8e5f04a into node-modules:masterUh oh!
There was an error while loading. Please reload this page.
[skip ci] ## [1.10.2](v1.10.1...v1.10.2) (2025-05-22) ### Bug Fixes * should handle ./ relative path ([#109](#109)) ([8e5f04a](8e5f04a))
bytemain commented May 23, 2025
Thanks! Finally accepted by the organization. |
We have a tgz its entry path is
./foo/bar, and when invokestripFileName(1, './foo/bar'), it always returnfoo/bar, actually, we expect it to returnbarSummary by CodeRabbit
Bug Fixes
Tests