Skip to content

Commit 557385e

Browse files
committed
Add quoting of path base name
1 parent 39762ae commit 557385e

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)