Skip to content

Commit 7e736b6

Browse files
committed
UrlResource applies StringUtils.getFilename against cleaned URL path
Issue: SPR-15411 (cherry picked from commit 702e01a)
1 parent 8b05484 commit 7e736b6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -229,12 +229,11 @@ public Resource createRelative(String relativePath) throws MalformedURLException
229229

230230
/**
231231
* This implementation returns the name of the file that this URL refers to.
232-
* @see java.net.URL#getFile()
233-
* @see java.io.File#getName()
232+
* @see java.net.URL#getPath()
234233
*/
235234
@Override
236235
public String getFilename() {
237-
return new File(this.url.getFile()).getName();
236+
return StringUtils.getFilename(this.cleanedUrl.getPath());
238237
}
239238

240239
/**

0 commit comments

Comments
 (0)