aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-07-07 14:21:15 +0200
committerGitHub <noreply@github.com>2023-07-07 14:21:15 +0200
commit14cd0f3e42e13927f9852d2cb74cc0098c1a429c (patch)
tree7da6ca0fbae833ab58d5d9ee2f353fa96eb0fe27 /plugins/base/src/main/kotlin/renderers/html
parentf23a4a9e72b372e94f28fa95d3ca595e9945857a (diff)
downloaddokka-14cd0f3e42e13927f9852d2cb74cc0098c1a429c.tar.gz
dokka-14cd0f3e42e13927f9852d2cb74cc0098c1a429c.tar.bz2
dokka-14cd0f3e42e13927f9852d2cb74cc0098c1a429c.zip
Do not leak unknown asset paths into HTML (#3061)
Fixes #3040
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt b/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt
index 4fee280e..aae2f65d 100644
--- a/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/innerTemplating/DefaultTemplateModelFactory.kt
@@ -92,7 +92,7 @@ class DefaultTemplateModelFactory(val context: DokkaContext) : TemplateModelFact
private fun Appendable.resourcesForPage(pathToRoot: String, resources: List<String>): Unit =
resources.forEach {
- append(with(createHTML()) {
+ val resourceHtml = with(createHTML()) {
when {
it.URIExtension == "css" ->
link(
@@ -112,7 +112,11 @@ class DefaultTemplateModelFactory(val context: DokkaContext) : TemplateModelFact
it.isImage() -> link(href = if (it.isAbsolute) it else "$pathToRoot$it")
else -> null
}
- } ?: it)
+ }
+
+ if (resourceHtml != null) {
+ append(resourceHtml)
+ }
}
}