Unverified Commit a9e2bb0a authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

fix pattern matching for locator replacement

parent adcbc96a
Pipeline #20175 passed with stages
in 7 minutes and 17 seconds
......@@ -19,7 +19,6 @@
package ch.memobase
import org.apache.logging.log4j.scala.Logging
import org.memobase.fedora.{FedoraClient, FedoraClientImpl}
import java.io.ByteArrayOutputStream
......@@ -34,7 +33,7 @@ import scala.util.Try
*
* @param fc Wrapped [[org.memobase.fedora.FedoraClient]] instance
*/
class FedoraClientWrapper(fc: FedoraClient) extends Logging {
class FedoraClientWrapper(fc: FedoraClient) {
import FedoraClientWrapper.copyDataAndCloseResource
......@@ -45,7 +44,6 @@ class FedoraClientWrapper(fc: FedoraClient) extends Logging {
* @return
*/
def fetchBinaryResource(url: String): Try[ByteArrayOutputStream] = {
logger.info(s"Try fetching from $url")
for {
u <- Try(new URL(url))
ip <- Try(io.Source.fromURL(u))
......
......@@ -20,7 +20,6 @@
package ch.memobase.models
import ch.memobase.RecordUtils
import org.apache.logging.log4j.scala.Logging
import ujson.Value
import scala.collection.mutable.ArrayBuffer
......@@ -43,7 +42,7 @@ case class BinaryResourceMetadata(id: String,
eventType: Event) {
}
object BinaryResourceMetadata extends RecordUtils with Logging {
object BinaryResourceMetadata extends RecordUtils {
/**
* Builds a `BinaryResourceMetadata` object from a JSON-LD object pulled from Kafka topic
......@@ -59,10 +58,7 @@ object BinaryResourceMetadata extends RecordUtils with Logging {
}
private def buildDistributorUrl(longId: String, baseUrl: String, distributorHost: String, resourceType: MemobaseResource): String = {
logger.info(longId)
logger.info(baseUrl)
logger.info(distributorHost)
val pattern = raw"""$baseUrl/digital/([^/]+)-1""".r
val pattern = raw"""${baseUrl.stripSuffix("/")}/digital/([^/]+)-1""".r
pattern.findFirstMatchIn(longId) match {
case Some(m) =>
resourceType match {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment