Extract filename from cleaned path (for consistent separator handling)

See gh-29486
This commit is contained in:
Juergen Hoeller 2022-11-14 23:53:39 +01:00
parent 588a70218a
commit 7d2543ed82
1 changed files with 2 additions and 1 deletions

View File

@ -304,7 +304,8 @@ public class UrlResource extends AbstractFileResolvingResource {
@Override
@Nullable
public String getFilename() {
String filename = StringUtils.getFilename(this.uri != null ? this.uri.getPath() : this.url.getPath());
String originalPath = (this.uri != null ? this.uri.getPath() : this.url.getPath());
String filename = StringUtils.getFilename(StringUtils.cleanPath(originalPath));
return (filename != null ? URLDecoder.decode(filename, StandardCharsets.UTF_8) : null);
}