Skip to content

Commit

Permalink
chore: bump sipi to rc.7 (DSP-733) (#1721)
Browse files Browse the repository at this point in the history
* chore: bump sipi to rc.7

* chore(sipi): Remove workaround for fixed bug DSP-711.

Co-authored-by: Benjamin Geer <benjaminlewis.geer@unibas.ch>
  • Loading branch information
subotic and Benjamin Geer committed Sep 30, 2020
1 parent a88d20d commit b635495
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
4 changes: 2 additions & 2 deletions third_party/versions.bzl
Expand Up @@ -8,10 +8,10 @@ METRICS_VERSION = "4.0.1"

# SIPI - digest takes precedence!
SIPI_REPOSITORY = "daschswiss/sipi"
SIPI_VERSION = "3.0.0-rc.5"
SIPI_VERSION = "3.0.0-rc.7"
SIPI_TAG = "v" + SIPI_VERSION
SIPI_IMAGE = SIPI_REPOSITORY + ":" + SIPI_VERSION
SIPI_IMAGE_DIGEST = "sha256:3a3eba0bb0ba9e3c772012c03fb93c7187e8a1016cc4ee0d975b37920c56ccfa"
SIPI_IMAGE_DIGEST = "sha256:0ae1ca94148c2f159a03390718703625d5262b2c7097baf20579dfceb934f090"

# Jena Fuseki - digest takes precedence!
FUSEKI_REPOSITORY = "stain/jena-fuseki"
Expand Down
Expand Up @@ -236,16 +236,14 @@ class SipiConnector extends Actor with ActorLogging {
*
* @param originalFilename the file's original filename, if known.
* @param originalMimeType the file's original MIME type.
* @param internalMimeType the file's internal MIME type (https://dasch.myjetbrains.com/youtrack/issue/DSP-711).
* @param mimeType the file's internal MIME type (https://dasch.myjetbrains.com/youtrack/issue/DSP-711).
* @param internalMimeType the file's internal MIME type.
* @param width the file's width in pixels, if applicable.
* @param height the file's height in pixels, if applicable.
* @param numpages the number of pages in the file, if applicable.
*/
case class SipiKnoraJsonResponse(originalFilename: Option[String],
originalMimeType: Option[String],
internalMimeType: Option[String],
mimeType: Option[String],
internalMimeType: String,
width: Option[Int],
height: Option[Int],
numpages: Option[Int]) {
Expand All @@ -259,7 +257,7 @@ class SipiConnector extends Actor with ActorLogging {
}

object SipiKnoraJsonResponseProtocol extends SprayJsonSupport with DefaultJsonProtocol {
implicit val sipiKnoraJsonResponseFormat: RootJsonFormat[SipiKnoraJsonResponse] = jsonFormat7(SipiKnoraJsonResponse)
implicit val sipiKnoraJsonResponseFormat: RootJsonFormat[SipiKnoraJsonResponse] = jsonFormat6(SipiKnoraJsonResponse)
}

/**
Expand All @@ -277,20 +275,11 @@ class SipiConnector extends Actor with ActorLogging {
for {
sipiResponseStr <- doSipiRequest(sipiRequest)
sipiResponse: SipiKnoraJsonResponse = sipiResponseStr.parseJson.convertTo[SipiKnoraJsonResponse]

// Workaround for https://dasch.myjetbrains.com/youtrack/issue/DSP-711

internalMimeType: String = sipiResponse.internalMimeType.getOrElse(sipiResponse.mimeType.getOrElse(throw SipiException(s"Sipi returned no internal MIME type in response to $knoraInfoUrl")))

correctedInternalMimeType: String = internalMimeType match {
case "text/comma-separated-values" => "text/csv"
case other => other
}
} yield
GetFileMetadataResponseV2(
originalFilename = sipiResponse.originalFilename,
originalMimeType = sipiResponse.originalMimeType,
internalMimeType = correctedInternalMimeType,
internalMimeType = sipiResponse.internalMimeType,
width = sipiResponse.width,
height = sipiResponse.height,
pageCount = sipiResponse.numpages
Expand Down

0 comments on commit b635495

Please sign in to comment.