Skip to content

Commit c23c8b8

Browse files
authored
only return 500 error in None case, fixes #84. (#85)
1 parent 6094bcb commit c23c8b8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
### Fixed
1313
- proxy will no correctly handle paths that end with a / at the end.
14+
- submitting an extraction will always return a 500 error, see [#84](https://github.com/clowder-framework/clowder/issues/84)
1415

1516
### CHanged
1617
- updated update-clowder script to work with migration to github

app/api/Extractions.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,22 +530,24 @@ class Extractions @Inject()(
530530
datasetId = datasetslists.head.id
531531
}
532532
// if extractor_id is not specified default to execution of all extractors matching mime type
533-
val key = (request.body \ "extractor").asOpt[String] match {
533+
(request.body \ "extractor").asOpt[String] match {
534534
case Some(extractorId) =>
535535
val job_id = p.submitFileManually(new UUID(originalId), file, Utils.baseUrl(request), extractorId, extra,
536536
datasetId, newFlags, request.apiKey, request.user)
537537
Ok(Json.obj("status" -> "OK", "job_id" -> job_id))
538-
case None =>
538+
case None => {
539539
p.fileCreated(file, None, Utils.baseUrl(request), request.apiKey) match {
540540
case Some(job_id) => {
541541
Ok(Json.obj("status" -> "OK", "job_id" -> job_id))
542542
}
543+
case None => {
544+
val message = "No jobId found for Extraction on fileid=" + file_id.stringify
545+
Logger.error(message)
546+
InternalServerError(toJson(Map("status" -> "KO", "msg" -> message)))
547+
}
543548
}
549+
}
544550
}
545-
546-
val message = "No jobId found for Extraction on fileid=" + file_id.stringify
547-
Logger.error(message)
548-
InternalServerError(toJson(Map("status" -> "KO", "msg" -> message)))
549551
} else {
550552
Conflict(toJson(Map("status" -> "error", "msg" -> "File is not ready. Please wait and try again.")))
551553
}

0 commit comments

Comments
 (0)