) : DataDocument<GridFsEntry>
private class GridFsStorage(val table: DocumentTable<GridFsEntry>, 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)))
fun defaults(lorePath: StoragePath) = defaults(lorePath.elements.drop(1))
fun defaults(lorePath: List<String>) = 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(),
)
}
.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(),