Skip to content

Commit 4178fc8

Browse files
authored
Merge pull request #9 from Nordstrom/pr/fix-filename-matching
Add quoting of path base name
2 parents 39762ae + 557385e commit 4178fc8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/nordstrom/common/file/PathUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static Path getNextPath(Path targetPath, String baseName, String extensio
168168
throw new IllegalArgumentException("[extension] must specify a non-empty string");
169169
}
170170

171-
PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("regex:" + baseName + "(-\\d+)?\\." + extension);
171+
PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("regex:\\Q" + baseName + "\\E(-\\d+)?\\." + extension);
172172

173173
try (Stream<Path> stream = Files.walk(targetPath, 1)) {
174174
int base = baseName.length();

0 commit comments

Comments
 (0)