Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove Windows filename reserved chars (<>:"/|?*)
  • Loading branch information
Luca Rota authored and eric.r.driggs committed May 31, 2023
1 parent cac54e1 commit bd607d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions karate-core/src/main/java/com/intuit/karate/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ public static String toIdString(String name) {
if (name == null) {
return "";
}
return name.replaceAll("[\\s_\\\\/:]", "-").toLowerCase();
return name.replaceAll("[\\s_\\\\/:<>\"\\|\\?\\*]", "-").toLowerCase();
}

public static StringUtils.Pair splitByFirstLineFeed(String text) {
public static StringUtils.Pair splitByFirstLineFeed(String text) {
String left = "";
String right = "";
if (text != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ void testToIdString() {
assertEquals("foo--bar", StringUtils.toIdString("foo//bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo\\bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo:bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo?bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo\"bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo*bar"));
assertEquals("foo-bar", StringUtils.toIdString("foo|bar"));
assertEquals("foo--bar", StringUtils.toIdString("foo<>bar"));
assertEquals("", StringUtils.toIdString(null)); // TODO
}

Expand Down

0 comments on commit bd607d1

Please sign in to comment.