Prevent NPE when using pathExtension predicate
This commit ensures pathExtension predicate is skipped when the value is null, in order to provide a more predictable behavior, and allow a better compatibility with collections not supporting null elements like the ones created by List#of. Closes gh-32404
This commit is contained in:
@@ -843,7 +843,7 @@ public abstract class RequestPredicates {
|
||||
@Override
|
||||
public boolean test(ServerRequest request) {
|
||||
String pathExtension = UriUtils.extractFileExtension(request.path());
|
||||
return this.extensionPredicate.test(pathExtension);
|
||||
return (pathExtension != null && this.extensionPredicate.test(pathExtension));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user