Skip to content

Commit

Permalink
Merge pull request #9 from Nordstrom/pr/fix-filename-matching
Browse files Browse the repository at this point in the history
Add quoting of path base name
  • Loading branch information
sbabcoc committed Nov 21, 2018
2 parents 39762ae + 557385e commit 4178fc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/nordstrom/common/file/PathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static Path getNextPath(Path targetPath, String baseName, String extensio
throw new IllegalArgumentException("[extension] must specify a non-empty string");
}

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

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

0 comments on commit 4178fc8

Please sign in to comment.