diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PathUtils.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PathUtils.java index fb9bc615..f4b29c37 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PathUtils.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/PathUtils.java @@ -269,7 +269,8 @@ public abstract class PathUtils { } locationPath = (locationPath.endsWith("/") || locationPath.isEmpty() ? locationPath : locationPath + "/"); String encodedLocationPath = locationPath.endsWith("/") - ? locationPath.substring(0, locationPath.length() - 1) + URLEncoder.encode("/", StandardCharsets.UTF_8) : locationPath; + ? locationPath.substring(0, locationPath.length() - 1) + URLEncoder.encode("/", StandardCharsets.UTF_8) + : locationPath; return ((resourcePath.startsWith(locationPath) || resourcePath.startsWith(encodedLocationPath)) && !isInvalidEncodedPath(resourcePath)); }