auto content size when serving image (todo: stream?)

This commit is contained in:
Thibault Duplessis 2019-12-12 12:27:30 -06:00
parent fefae5fb3f
commit b192b0c048

View file

@ -103,8 +103,7 @@ final class Main(
case Some(image) =>
lila.log("image").info(s"Serving ${image.path} to ${HTTPRequest printClient req}")
Ok(image.data).withHeaders(
CONTENT_DISPOSITION -> image.name,
CONTENT_LENGTH -> image.size.toString
CONTENT_DISPOSITION -> image.name
) as image.contentType.getOrElse("image/jpeg")
}
}