Fix issue #3119#3120
Conversation
|
@GlaDrancE is attempting to deploy a commit to the Onlook Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesCross-platform directory extraction fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
Fixes a Windows-only crash in the setup:env script. ensureDirectoryExists() in packages/scripts/src/api-keys.ts derived the target directory using a hardcoded forward-slash search (filePath.substring(0, filePath.lastIndexOf('/'))). On Windows, paths use backslashes (e.g. A:...\client.env), so lastIndexOf('/') returns -1, substring(0, -1) returns '', and the subsequent fs.mkdirSync('') throws ENOENT: mkdir '' — preventing the API keys from being written.
Replaced the manual string slicing with Node's cross-platform path.dirname(), plus a guard to skip an empty directory. This produces identical results on Linux/macOS (no regression) and correctly handles backslash paths on Windows.
Related Issues
closes #3119
Type of Change
Testing
Before:
✓ Set OPENROUTER_API_KEY key
Failed to write API keys: Error: ENOENT: no such file or directory, mkdir ''
After:
✓ Set OPENROUTER_API_KEY key
✅ API keys updated successfully!
Screenshots (if applicable)
N/A — CLI script change.
Summary by CodeRabbit