jaredLunde / jaredLunde/exploration

Bug: Handle Both Windows and UNIX Path Separators

Open
#32 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
60
Forks
4
PR merge metrics
No merged PRs in 30d

Description

## Description:
The current `SEP_NEGATE_RE` regular expression only supports UNIX-style paths with the `/` separator. However, it fails to handle Windows-style paths, which use the `\` separator. This bug causes the `split` function to incorrectly split Windows paths.

## Steps to Reproduce:
1. Run the `split` function with a Windows path, for example:
```js
split("C:\\Users\\Administrator\\Documents\\KKNote\\Notes.md");
```
2. The function does not properly split the path and returns incorrect results.

## Expected Behavior:
The `split` function should correctly handle both UNIX-style and Windows-style paths. It should split the path by both `/` and `\` separators, and return the correct path components.

#### Solution:
- Modify the `SEP_NEGATE_RE` regular expression to handle both `/` and `\` as valid path separators:
```js
const SEP_NEGATE_RE = /[^\\/]+/g;
```
- This change will allow the function to split paths with either separator.

## Example:
For the input path `C:\\Users\\Administrator\\Documents\\KKNote\\Notes.md`, the expected output should be:
```js
[
"C:",
"Users",
"Administrator",
"Documents",
"KKNote",
"Notes.md"
]
```

Contributor guide

Open the contributing guide

Research direction

Search the codebase for SEP_NEGATE_RE and the split function to locate the path-splitting implementation. Verify the existing behavior for UNIX paths, then exercise the Windows example and confirm that both separators produce the listed path components.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.