From 5cfb234cc7a64a76494fbe6e04a6129b764c5916 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 6 Feb 2021 13:01:35 +0000 Subject: [PATCH] Use Ktor's Content-Disposition builder Signed-off-by: Graham --- .../kotlin/org/openrs2/archive/web/CachesController.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/archive/src/main/kotlin/org/openrs2/archive/web/CachesController.kt b/archive/src/main/kotlin/org/openrs2/archive/web/CachesController.kt index b15969ab31..998ec8ce7e 100644 --- a/archive/src/main/kotlin/org/openrs2/archive/web/CachesController.kt +++ b/archive/src/main/kotlin/org/openrs2/archive/web/CachesController.kt @@ -1,7 +1,9 @@ package org.openrs2.archive.web import io.ktor.application.ApplicationCall +import io.ktor.http.ContentDisposition import io.ktor.http.ContentType +import io.ktor.http.HttpHeaders import io.ktor.http.HttpStatusCode import io.ktor.response.header import io.ktor.response.respond @@ -31,7 +33,13 @@ public class CachesController @Inject constructor( return } - call.response.header("Content-Disposition", "attachment; filename=\"cache.zip\"") + call.response.header( + HttpHeaders.ContentDisposition, + ContentDisposition.Attachment + .withParameter(ContentDisposition.Parameters.FileName, "cache.zip") + .toString() + ) + call.respondOutputStream(contentType = ContentType.Application.Zip) { DiskStoreZipWriter(ZipOutputStream(this), alloc = alloc).use { store -> exporter.export(id, store)