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
This commit is contained in:
_ext Slovak, Jiri
2024-02-21 22:00:23 +01:00
committed by Phillip Webb
parent 428ddb710b
commit 06569e76f6

View File

@@ -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());