Skip to content

Commit

Permalink
Decode URL content before passing it to NestedLocation.parse
Browse files Browse the repository at this point in the history
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
  • Loading branch information
_ext Slovak, Jiri authored and philwebb committed Feb 22, 2024
1 parent 428ddb7 commit 06569e7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.Map;
import java.util.Map.Entry;

import org.springframework.boot.loader.net.util.UrlDecoder;
import org.springframework.boot.loader.ref.Cleaner;

/**
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 06569e7

Please sign in to comment.