Skip to content

Commit 7d2543e

Browse files
committed
Extract filename from cleaned path (for consistent separator handling)
See gh-29486
1 parent 588a702 commit 7d2543e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-core/src/main/java/org/springframework/core/io/UrlResource.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ protected URL createRelativeURL(String relativePath) throws MalformedURLExceptio
304304
@Override
305305
@Nullable
306306
public String getFilename() {
307-
String filename = StringUtils.getFilename(this.uri != null ? this.uri.getPath() : this.url.getPath());
307+
String originalPath = (this.uri != null ? this.uri.getPath() : this.url.getPath());
308+
String filename = StringUtils.getFilename(StringUtils.cleanPath(originalPath));
308309
return (filename != null ? URLDecoder.decode(filename, StandardCharsets.UTF_8) : null);
309310
}
310311

0 commit comments

Comments
 (0)