mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Avoid recompiling pattern in Handler#canonicalize
See gh-21103
This commit is contained in:
parent
3f96e2165a
commit
848127ae49
@ -49,6 +49,8 @@ public class Handler extends URLStreamHandler {
|
||||
|
||||
private static final String SEPARATOR = "!/";
|
||||
|
||||
private static final Pattern SEPARATOR_PATTERN = Pattern.compile(SEPARATOR, Pattern.LITERAL);
|
||||
|
||||
private static final String CURRENT_DIR = "/./";
|
||||
|
||||
private static final Pattern CURRENT_DIR_PATTERN = Pattern.compile(CURRENT_DIR, Pattern.LITERAL);
|
||||
@ -285,7 +287,7 @@ public class Handler extends URLStreamHandler {
|
||||
}
|
||||
|
||||
private String canonicalize(String path) {
|
||||
return path.replace(SEPARATOR, "/");
|
||||
return SEPARATOR_PATTERN.matcher(path).replaceAll("/");
|
||||
}
|
||||
|
||||
public JarFile getRootJarFileFromUrl(URL url) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user