Skip to content

Commit

Permalink
Merge branch 'release/1.19.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Jan 7, 2019
2 parents 053b840 + fffcfa7 commit 6c1ddca
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [1.19.5] - 2019-01-08
### Changed
- Use openjdk:8-alpine as base Docker image

## [1.19.4] - 2019-01-06
### Changed
- Update dependencies
Expand Down Expand Up @@ -165,7 +169,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
- Adapt [`sbt-native-packager`](https://github.com/sbt/sbt-native-packager) for [Heroku](https://heroku.com/)


[Unreleased]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.4...HEAD
[Unreleased]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.5...HEAD
[1.19.5]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.4...v1.19.5
[1.19.4]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.3...v1.19.4
[1.19.3]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.2...v1.19.3
[1.19.2]: https://github.com/nwtgck/trans-server-akka/compare/v1.19.1...v1.19.2
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN sbt assembly


# Open JDK 8 - Alpine
FROM java:openjdk-8-alpine
FROM openjdk:8-alpine
LABEL maintainer="Ryo Ota <nwtgck@gmail.com>"

# Make directories
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbtassembly.AssemblyPlugin.autoImport.assemblyJarName

name := "trans-server-akka"

version := "1.19.4"
version := "1.19.5"

scalaVersion := "2.11.12"

Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/io/github/nwtgck/trans_server/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Core(db: Database, fileDbPath: String, enableTopPageHttpsRedirect: Boolean

// Calc length of ByteString
val lengthSink : Sink[ByteString, Future[Long]] =
Sink.fold(0l)(_ + _.length)
Sink.fold(0L)(_ + _.length)

// Sink for calculating MD5
val md5Sink: Sink[ByteString, Future[Digest[Algorithm.`MD5`.type]]] =
Expand Down Expand Up @@ -436,10 +436,10 @@ class Core(db: Database, fileDbPath: String, enableTopPageHttpsRedirect: Boolean
StatusCodes.TemporaryRedirect
)
case Failure(ex) =>
complete(StatusCodes.BadRequest, s"Error in URI parse\n")
complete(StatusCodes.BadRequest, "Error in URI parse\n")
}
case Failure(ex) =>
complete(StatusCodes.InternalServerError, s"Unexpected error in redirection\n")
complete(StatusCodes.InternalServerError, "Unexpected error in redirection\n")
}
} else {
complete(StatusCodes.BadRequest, s"URI whose length is ${fileStore.rawLength} is too long. Max length is ${Setting.MaxRedirectionUriLength}.\n")
Expand Down Expand Up @@ -512,7 +512,7 @@ class Core(db: Database, fileDbPath: String, enableTopPageHttpsRedirect: Boolean
responseGenerator(fileStore, getFileSource(getKey + Setting.FileEncryptionKey))
case None =>
logger.error("Critical Error: getting password of Basic Authentication (This will never happen)")
complete(StatusCodes.InternalServerError, s"Server error in Basic Authentication\n")
complete(StatusCodes.InternalServerError, "Server error in Basic Authentication\n")
}
}
}
Expand All @@ -524,7 +524,7 @@ class Core(db: Database, fileDbPath: String, enableTopPageHttpsRedirect: Boolean
}

case _ =>
complete(StatusCodes.InternalServerError, s"Server error in decrement nGetLimit\n")
complete(StatusCodes.InternalServerError, "Server error in decrement nGetLimit\n")
}
}
} else {
Expand Down Expand Up @@ -655,7 +655,7 @@ class Core(db: Database, fileDbPath: String, enableTopPageHttpsRedirect: Boolean
case Success(_) =>
complete("Deleted successfully\n")
case _ =>
complete(StatusCodes.InternalServerError, s"Server error in delete a file\n")
complete(StatusCodes.InternalServerError, "Server error in delete a file\n")
}
} else {
complete(StatusCodes.NotFound, s"File ID '${fileId.value}' is not found\n")
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/github/nwtgck/trans_server/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object Main {
}
} yield ()).onComplete{
case Success(_) =>
logger.info(s"Running server!")
logger.info("Running server!")
case Failure(e) =>
logger.error(s"Error in running server\n${Util.getStackTraceString(e)}", e)
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/scala/io/github/nwtgck/trans_server/CoreSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class CoreSpec extends FunSpec with ScalatestRouteTest with Matchers with Before

describe("top page") {
it("should show the top page") {
Get(s"/") ~> core.route ~> check {
Get("/") ~> core.route ~> check {
// Just check status code
status.intValue() shouldBe 200
}
}

it("should redirect page if X-Forwarded-Proto header is specified") {
Get(s"/") ~> addHeader("X-Forwarded-Proto", "http") ~> core.route ~> check {
Get("/") ~> addHeader("X-Forwarded-Proto", "http") ~> core.route ~> check {
// Status should be "Permanent Redirect"
status shouldBe StatusCodes.PermanentRedirect
}
Expand All @@ -82,7 +82,7 @@ class CoreSpec extends FunSpec with ScalatestRouteTest with Matchers with Before
// NOTE: Should test but error, "java.lang.IllegalArgumentException: Illegal HTTP header 'X-Forwarded-Proto': Invalid input ',', expected scheme-char or 'EOI'"
if(false) {
it("should not redirect page if X-Forwarded-Proto header is https,http,http for Glitch") {
Get(s"/") ~> addHeader("X-Forwarded-Proto", "https,http,http") ~> core.route ~> check {
Get("/") ~> addHeader("X-Forwarded-Proto", "https,http,http") ~> core.route ~> check {
// Status should NOT be "Permanent Redirect"
// Just check status code
status.intValue() shouldBe 200
Expand All @@ -109,7 +109,7 @@ class CoreSpec extends FunSpec with ScalatestRouteTest with Matchers with Before

describe("help page") {
it("should show help page") {
Get(s"/help") ~> core.route ~> check {
Get("/help") ~> core.route ~> check {
// Just check status code
status.intValue() shouldBe 200
}
Expand All @@ -118,7 +118,7 @@ class CoreSpec extends FunSpec with ScalatestRouteTest with Matchers with Before

describe("version page") {
it("should show version page") {
Get(s"/version") ~> core.route ~> check {
Get("/version") ~> core.route ~> check {
val versionStr: String = responseAs[String].trim
// Check version page
versionStr shouldBe BuildInfo.version
Expand Down

0 comments on commit 6c1ddca

Please sign in to comment.