Skip to content

Commit

Permalink
fix: Fix the 500 error when submitting a route with a blank query or …
Browse files Browse the repository at this point in the history
…header match condition (#347)
  • Loading branch information
CH3CHO authored Sep 29, 2024
1 parent 15a1486 commit 6773803
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1614,13 +1614,19 @@ private static String buildImageUrl(String imageRepository, String imageVersion)
}

private void setQueryAnnotation(V1ObjectMeta metadata, KeyedRoutePredicate keyedRoutePredicate) {
if (StringUtils.isAnyBlank(keyedRoutePredicate.getMatchType(), keyedRoutePredicate.getKey(), keyedRoutePredicate.getMatchValue())){
return;
}
RoutePredicateTypeEnum predicateType = RoutePredicateTypeEnum.valueOf(keyedRoutePredicate.getMatchType());
String annotationName = String.format(KubernetesConstants.Annotation.QUERY_MATCH_KEY_FORMAT,
predicateType.getAnnotationPrefix(), keyedRoutePredicate.getKey());
KubernetesUtil.setAnnotation(metadata, annotationName, keyedRoutePredicate.getMatchValue());
}

private void setHeaderAnnotation(V1ObjectMeta metadata, KeyedRoutePredicate keyedRoutePredicate) {
if (StringUtils.isAnyBlank(keyedRoutePredicate.getMatchType(), keyedRoutePredicate.getKey(), keyedRoutePredicate.getMatchValue())){
return;
}
RoutePredicateTypeEnum predicateType = RoutePredicateTypeEnum.valueOf(keyedRoutePredicate.getMatchType());
String key = keyedRoutePredicate.getKey();
String format = KubernetesConstants.Annotation.HEADER_MATCH_KEY_FORMAT;
Expand Down

0 comments on commit 6773803

Please sign in to comment.