URL decoding for cluster names (#1378)

Co-authored-by: Nikita Bystrov <n.bysterov>
This commit is contained in:
bystnik 2022-01-18 02:32:41 -08:00 committed by GitHub
parent a4fce3cd81
commit 0a7d64de78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,8 @@ package com.provectus.kafka.ui.config;
import com.provectus.kafka.ui.exception.ClusterNotFoundException;
import com.provectus.kafka.ui.exception.ReadOnlyModeException;
import com.provectus.kafka.ui.service.ClustersStorage;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
@ -32,7 +34,8 @@ public class ReadOnlyModeFilter implements WebFilter {
}
var path = exchange.getRequest().getPath().pathWithinApplication().value();
var matcher = CLUSTER_NAME_REGEX.matcher(path);
var decodedPath = URLDecoder.decode(path, StandardCharsets.UTF_8);
var matcher = CLUSTER_NAME_REGEX.matcher(decodedPath);
if (!matcher.find()) {
return chain.filter(exchange);
}