Skip to content

Commit

Permalink
Fixes #14336. (#14339)
Browse files Browse the repository at this point in the history
Don't blow up on missing path transform configuration.

Signed-off-by: Lukas Krejci <lkrejci@redhat.com>
  • Loading branch information
metlos authored Aug 27, 2019
1 parent 0d905e4 commit a291807
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public IngressPathTransformInverter(
* @return the regex that essentially reverts the effect of the path transformation
*/
private static Pattern extractPathFromFmt(String pathTransformFmt) {
if (pathTransformFmt == null) {
return Pattern.compile("^(.*)$");
}
Matcher m = PATH_FORMAT_DECONSTRUCTION_REGEX.matcher(pathTransformFmt);
if (m.matches() && m.groupCount() == 2) {
String prefix = Pattern.quote(m.group(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static Object[][] transformationTestCases() {
{"%ssuffix", "pathsuffix", "path"},
{"prefix%s", "prefixpath", "path"},
{"prefix%ssuffix", "prefixpathsuffix", "path"},
{"prefix%s", "non-matching", "non-matching"}
{"prefix%s", "non-matching", "non-matching"},
{null, "some path", "some path"}
};
}
}

0 comments on commit a291807

Please sign in to comment.