KEYCLOAK-15012 Fix issue with folder theme provider
This commit is contained in:
parent
2df62369c3
commit
1281f28bb8
2 changed files with 10 additions and 2 deletions
|
@ -93,7 +93,7 @@ public class FolderTheme implements Theme {
|
|||
}
|
||||
|
||||
File file = new File(resourcesDir, path);
|
||||
if (!file.isFile() || !file.getCanonicalPath().startsWith(resourcesDir.getCanonicalPath())) {
|
||||
if (!file.isFile() || !file.getCanonicalPath().startsWith(resourcesDir.getCanonicalPath() + File.separator)) {
|
||||
return null;
|
||||
} else {
|
||||
return file.toURI().toURL().openStream();
|
||||
|
|
|
@ -84,7 +84,15 @@ public class FolderThemeProvider implements ThemeProvider {
|
|||
}
|
||||
|
||||
private File getThemeDir(String name, Theme.Type type) {
|
||||
return new File(themesDir, name + File.separator + type.name().toLowerCase());
|
||||
File f = new File(themesDir, name + File.separator + type.name().toLowerCase());
|
||||
try {
|
||||
if (!f.getCanonicalPath().startsWith(themesDir.getCanonicalPath() + File.separator)) {
|
||||
return null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue