import kotlin.time.Duration.Companion.hours
suspend fun ApplicationCall.respondStoredFile(fileStorage: FileStorage, path: StoragePath) {
- val stat = fileStorage.statFile(path) ?: return respond(HttpStatusCode.NotFound)
-
+ val content = fileStorage.readFile(path) ?: return respond(HttpStatusCode.NotFound)
val extension = path.elements.last().substringAfter('.', "")
val type = if (extension.isEmpty()) ContentType.Text.Plain else ContentType.defaultForFileExtension(extension)
- val content = fileStorage.readFile(path) ?: return respond(HttpStatusCode.NotFound)
attributes.put(StoragePathAttributeKey, path)
respondBytes(content, type)