Conversation
Replace hardcoded forward slash '/' with DIRECTORY_SEPARATOR constant on line 155. On Windows, realpath() returns paths with backslashes (e.g., C:\Windows\Temp), but the hardcoded '/' created a mixed path (C:\Windows\Temp/). This caused str_starts_with() check on line 247 to fail, preventing CSV imports. Co-authored-by: adnan007.id <adnan007.id@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the CSV importer that prevented imports from working on Windows servers. The issue occurred because a hardcoded forward slash (/) was used in path construction, while Windows realpath() returns backslashes, causing a security check to fail.
Changes:
- Updated path separator in CSV importer to use
DIRECTORY_SEPARATORinstead of hardcoded/for cross-platform compatibility - Added changelog entry documenting the fix
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| projects/plugins/crm/includes/ZeroBSCRM.CSVImporter.php | Replaced hardcoded forward slash with DIRECTORY_SEPARATOR when constructing temp directory path to fix Windows compatibility |
| projects/plugins/crm/changelog/fix-csv-import-path-separator-windows | Added changelog entry for the path separator fix |
| Significance: patch | ||
| Type: fixed | ||
|
|
||
| CSV Importer: fix path separator issue causing import failures on Windows servers. |
There was a problem hiding this comment.
The changelog entry should start with a capital letter. Change "fix" to "Fix" to follow the project's changelog guidelines.
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
|
I'm not sure how to test this on a Windows server but the code makes sense and it's a small change so I approved it. |
CSV Importer: Fix path separator issue causing import failures on Windows servers
Fixes JETCRM-64
Proposed changes:
/) withDIRECTORY_SEPARATORwhen constructing the temporary directory path inZeroBSCRM.CSVImporter.php. This resolves an issue whererealpath()on Windows returns backslashes, causing a path mismatch and failure in a security check (str_starts_with()).Other information:
Jetpack product discussion
None
Does this pull request change what data or activity we track or use?
No
Testing instructions: