From: Lanius Trolling Date: Sun, 22 Dec 2024 19:32:09 +0000 (-0500) Subject: Fix slashes in string concat calls X-Git-Url: https://gitweb.starshipfights.net/?a=commitdiff_plain;h=fde4a38788ac5df06182d86628220586bda16927;p=factbooks Fix slashes in string concat calls --- diff --git a/src/main/kotlin/info/mechyrdia/data/DataFiles.kt b/src/main/kotlin/info/mechyrdia/data/DataFiles.kt index 7e081d7..6813dfa 100644 --- a/src/main/kotlin/info/mechyrdia/data/DataFiles.kt +++ b/src/main/kotlin/info/mechyrdia/data/DataFiles.kt @@ -294,8 +294,8 @@ private data class GridFsEntry( ) : DataDocument private class GridFsStorage(val table: DocumentTable, val bucket: GridFSBucket) : FileStorage { - private fun toExactPath(path: StoragePath) = path.elements.concat("/", prefix = "/") - private fun toPrefixPath(path: StoragePath) = path.elements.concat("/", prefix = "/", suffix = "/") + private fun toExactPath(path: StoragePath) = path.elements.map { "/$it" }.concat() + private fun toPrefixPath(path: StoragePath) = path.elements.map { "/$it" }.concat(suffix = "/") private suspend fun testExact(path: StoragePath) = table.number(Filters.eq(GridFsEntry::path.serialName, toExactPath(path))) > 0L private suspend fun getExact(path: StoragePath) = table.locate(Filters.eq(GridFsEntry::path.serialName, toExactPath(path))) diff --git a/src/main/kotlin/info/mechyrdia/lore/ParserPreprocess.kt b/src/main/kotlin/info/mechyrdia/lore/ParserPreprocess.kt index 6f1e07d..188e89c 100644 --- a/src/main/kotlin/info/mechyrdia/lore/ParserPreprocess.kt +++ b/src/main/kotlin/info/mechyrdia/lore/ParserPreprocess.kt @@ -48,7 +48,7 @@ class PreProcessorContext private constructor( fun defaults(lorePath: StoragePath) = defaults(lorePath.elements.drop(1)) fun defaults(lorePath: List) = mapOf( - PAGE_PATH_KEY to lorePath.concat("/", prefix = "/").textToTree(), + PAGE_PATH_KEY to lorePath.map { "/$it" }.concat().textToTree(), INSTANT_NOW_KEY to Instant.now().toEpochMilli().numberToTree(), ) } diff --git a/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt b/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt index d9fd484..0425c37 100644 --- a/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt +++ b/src/main/kotlin/info/mechyrdia/route/ResourceWebDav.kt @@ -133,7 +133,7 @@ private suspend fun getWebDavPropertiesWithIncludeTags(path: StoragePath, webRoo .filterNotNull() .flatten() - val pathWithSuffix = path.elements.concat("/", suffix = "/") + val pathWithSuffix = path.elements.map { "$it/" }.concat() listOf( WebDavProperties.Collection( creationDate = subProps.mapNotNull { it.first.creationDate }.maxOrNull(),