From 06569e76f6155562bc0220fc97a8ac641e57a56d Mon Sep 17 00:00:00 2001 From: "_ext Slovak, Jiri" Date: Wed, 21 Feb 2024 22:00:23 +0100 Subject: [PATCH] Decode URL content before passing it to NestedLocation.parse URL can contains empty spaced encoded as %20, so it should be decoded before passing it to NestedLocation. NestedLocation expects file system path which should not contain URL encoded values. See gh-39675 --- .../boot/loader/net/protocol/nested/NestedUrlConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedUrlConnection.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedUrlConnection.java index 0409fe6e3d9..3dd03491f44 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedUrlConnection.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/net/protocol/nested/NestedUrlConnection.java @@ -38,6 +38,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.springframework.boot.loader.net.util.UrlDecoder; import org.springframework.boot.loader.ref.Cleaner; /** @@ -76,7 +77,7 @@ class NestedUrlConnection extends URLConnection { private NestedLocation parseNestedLocation(URL url) throws MalformedURLException { try { - return NestedLocation.parse(url.getPath()); + return NestedLocation.parse(UrlDecoder.decode(url.getPath())); } catch (IllegalArgumentException ex) { throw new MalformedURLException(ex.getMessage());