There was an error while loading. Please reload this page.
1 parent 70886e3 commit 2270df5Copy full SHA for 2270df5
spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java
@@ -423,6 +423,17 @@ protected Resource convertClassLoaderURL(URL url) {
423
}
424
425
else {
426
+String urlString = url.toString();
427
+String cleanedPath = StringUtils.cleanPath(urlString);
428
+if (!cleanedPath.equals(urlString)) {
429
+// Prefer cleaned URL, aligned with UrlResource#createRelative(String)
430
+try {
431
+return new UrlResource(ResourceUtils.toURI(cleanedPath));
432
+}
433
+catch (URISyntaxException | MalformedURLException ex) {
434
+// Fallback to regular URL construction below...
435
436
437
return new UrlResource(url);
438
439
0 commit comments