Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

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

change prefix for checking if local available file


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 8773970d
Pipeline #20148 failed with stages
in 3 minutes and 41 seconds
...@@ -56,9 +56,9 @@ trait RecordUtils { ...@@ -56,9 +56,9 @@ trait RecordUtils {
} }
} }
protected def isLocalRecord(obj: ujson.Obj, externalBaseUrl: String): Boolean = { protected def isLocalRecord(obj: ujson.Obj, sftpPrefix: String = "sftp:/"): Boolean = {
hasKeyValue(obj, "locator") { hasKeyValue(obj, "locator") {
value => value.startsWith(externalBaseUrl) value => value.startsWith(sftpPrefix)
} }
} }
......
...@@ -83,7 +83,7 @@ object BinaryResourceMetadata extends RecordUtils { ...@@ -83,7 +83,7 @@ object BinaryResourceMetadata extends RecordUtils {
val id = v.obj.getOrElse("@id", Value("<unknown id>")).str val id = v.obj.getOrElse("@id", Value("<unknown id>")).str
Try( Try(
v.obj match { v.obj match {
case v if isLocalRecord(v, baseUrl) && isProcessableMimeType(v) => case v if isLocalRecord(v) && isProcessableMimeType(v) =>
getEventType(jsonldGraph) match { getEventType(jsonldGraph) match {
case Some(UnknownEvent(e)) => throw new UnknownEventType(s"Event type `$e` for $id not known") case Some(UnknownEvent(e)) => throw new UnknownEventType(s"Event type `$e` for $id not known")
case Some(eventType) => case Some(eventType) =>
...@@ -100,7 +100,7 @@ object BinaryResourceMetadata extends RecordUtils { ...@@ -100,7 +100,7 @@ object BinaryResourceMetadata extends RecordUtils {
eventType) eventType)
case None => throw new NoEventType(id) case None => throw new NoEventType(id)
} }
case v if isLocalRecord(v, baseUrl) => case v if isLocalRecord(v) =>
val resource = MemobaseResource(v("type").str) val resource = MemobaseResource(v("type").str)
throw new UnmanageableMediaFileType(s"Media file type for $id unknown", resource) throw new UnmanageableMediaFileType(s"Media file type for $id unknown", resource)
case v => case v =>
......
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