Broken Windows path regex in FilteringUtils.getRelativeFilePath()
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- build-system
Research direction
Start in src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java at getRelativeFilePath(), especially lines 184 and 187, and trace the handling of a Windows-style /C:/foo path. Correct the two checks so the leading slash is removed, then verify the relevant path-normalization behavior with the existing tests.
Written by the indexing model from the issue text.
Description
In src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java, lines 184 and 187:
if (toPath.matches("^\\\\\\[a-zA-Z]:")) {
toPath = toPath.substring(1);
}
if (fromPath.matches("^\\\\\\[a-zA-Z]:")) {
fromPath = fromPath.substring(1);
}
The regex ^\\\\[a-zA-Z]: has a double-escaped backslash before the character class [a-zA-Z], making \\[ match a literal [ character at the start. The intended regex is ^[a-zA-Z]: — a drive letter followed by a colon at the start of the path. This regex will never match a Windows absolute path like C:\\foo, so the leading-slash stripping logic never executes. This is effectively dead code.
On Windows this could cause incorrect normalization of paths like /C:/foo where the leading / should be stripped.
- Dominant language
- Java
- Stars
- 9
- Forks
- 36
- Avg merge
- 6h 44m
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/maven-filtering
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/maven-filtering#358 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
apache/maven-filtering#357 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/maven-filtering#356 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-filtering#354 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/maven-filtering#350 ·
All issues in apache/maven-filtering
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100