mirror of
https://github.com/keycloak/keycloak.git
synced 2026-02-18 18:37:54 -05:00
fix: decode URI path before opening JAR file (#45972)
fix: use getSchemeSpecificPart updating how we determine the script jar file Signed-off-by: Steve Hawkins <shawkins@redhat.com> Co-authored-by: Konstantinos Kyriakou <kkyriakou@altair.com>
This commit is contained in:
parent
88eb05d114
commit
24193928c3
1 changed files with 7 additions and 3 deletions
|
|
@ -1038,7 +1038,7 @@ class KeycloakProcessor {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
throw new RuntimeException("Failed to discover script providers", e);
|
||||
}
|
||||
}
|
||||
|
|
@ -1078,8 +1078,8 @@ class KeycloakProcessor {
|
|||
return descriptors;
|
||||
}
|
||||
|
||||
private List<ScriptProviderDescriptor> getScriptProviderDescriptorsFromJarFile(URL url) throws IOException {
|
||||
String file = url.getFile();
|
||||
private List<ScriptProviderDescriptor> getScriptProviderDescriptorsFromJarFile(URL url) throws IOException, URISyntaxException {
|
||||
String file = url.toURI().getSchemeSpecificPart();
|
||||
|
||||
if (!file.contains(JAR_FILE_SEPARATOR)) {
|
||||
return List.of();
|
||||
|
|
@ -1090,6 +1090,10 @@ class KeycloakProcessor {
|
|||
try (JarFile jarFile = new JarFile(file.substring("file:".length(), file.indexOf(JAR_FILE_SEPARATOR)))) {
|
||||
JarEntry descriptorEntry = jarFile.getJarEntry(KEYCLOAK_SCRIPTS_JSON_PATH);
|
||||
|
||||
if (descriptorEntry == null) {
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
try (InputStream is = jarFile.getInputStream(descriptorEntry)) {
|
||||
ScriptProviderDescriptor descriptor = JsonSerialization.readValue(is, ScriptProviderDescriptor.class);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue