From 9bb5dfbb222c974d4cc0373c6c809e9f4f6333ea Mon Sep 17 00:00:00 2001 From: Christian Kaps Date: Tue, 11 Jul 2017 22:06:59 +0200 Subject: [PATCH 1/2] Release version 0.7.1 --- .../play/compressor/CompressorFilter.scala | 16 +++++----------- project/plugins.sbt | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/com/mohiva/play/compressor/CompressorFilter.scala b/app/com/mohiva/play/compressor/CompressorFilter.scala index 03d3015..d0a3305 100644 --- a/app/com/mohiva/play/compressor/CompressorFilter.scala +++ b/app/com/mohiva/play/compressor/CompressorFilter.scala @@ -83,27 +83,22 @@ abstract class CompressorFilter[C <: Compressor] extends Filter { * @return The compressed result. */ private def compressResult(result: Result): Future[Result] = { - def compress(data: ByteString) = compressor.compress(data.decodeString(charset).trim).getBytes(charset) if (isCompressible(result)) { result.body match { - case body0: HttpEntity.Strict => + case body: HttpEntity.Strict => Future.successful( - result.copy( - body = body0.copy( - data = ByteString(compress(body0.data)) - ) - ) + result.copy(body = body.copy(ByteString(compress(body.data)))) ) - case body0: HttpEntity.Streamed => + case body: HttpEntity.Streamed => for { - bytes <- body0.data.toMat(Sink.fold(ByteString())(_ ++ _))(Keep.right).run() + bytes <- body.data.toMat(Sink.fold(ByteString())(_ ++ _))(Keep.right).run() } yield { val compressed = compress(bytes) val length = compressed.length result.copy( - body = body0.copy( + body = body.copy( data = Source.single(ByteString(compressed)), contentLength = Some(length.toLong) ) @@ -116,5 +111,4 @@ abstract class CompressorFilter[C <: Compressor] extends Filter { Future.successful(result) } } - } diff --git a/project/plugins.sbt b/project/plugins.sbt index a57aeac..0e7db2e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,7 +5,7 @@ resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/release resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/" -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.0") +addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.1") addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0") From 787310dc121ed0cfc222047f3fdd02ecb1d539a4 Mon Sep 17 00:00:00 2001 From: Christian Kaps Date: Tue, 11 Jul 2017 22:09:56 +0200 Subject: [PATCH 2/2] Change version to 0.7.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9d922ed..a720b8b 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ In your project/Build.scala: ```scala libraryDependencies ++= Seq( - "com.mohiva" %% "play-html-compressor" % "0.7.0" + "com.mohiva" %% "play-html-compressor" % "0.7.1" ) ``` ### History -* For Play Framework 2.6 use version 0.7.0 +* For Play Framework 2.6 use version 0.7.1 * For Play Framework 2.5 use version 0.6.3 * For Play Framework 2.4 use version 0.5.0 * For Play Framework 2.3 use version 0.3.1