- Notifications
You must be signed in to change notification settings - Fork38.6k
Closed
Labels
Milestone
Description
This relates to#33199
Due to the custom encryption of JARs we have a customjava.net.URLStreamHandler
on URL instance.
In recent versions (from 6.1.x) the reimplemented methodorg.springframework.util.ResourceUtils#toRelativeURL
fails to retain the originalURLStreamHandler
on the root URL instance. Instead, it uses only the string part of the URL and creates a new one.
6.1.x:toURL(StringUtils.applyRelativePath(root.toString(), relativePath));
vs
6.0.x:new URL(root, relativePath);
I propose similar approach as was the fix for#33199
if (ResourceUtils.toURL(root.toString()).equals(root)) {// Plain URL with default URLStreamHandler -> replace with cleaned path.returntoURL(StringUtils.applyRelativePath(root.toString(),relativePath));;}else {// Retain original URL instance, potentially including custom URLStreamHandler.returnnewURL(root,relativePath);}