diff --git a/src/main/scala/com/campudus/tableaux/helper/JsonUtils.scala b/src/main/scala/com/campudus/tableaux/helper/JsonUtils.scala index 454a1119..de363fb5 100644 --- a/src/main/scala/com/campudus/tableaux/helper/JsonUtils.scala +++ b/src/main/scala/com/campudus/tableaux/helper/JsonUtils.scala @@ -259,11 +259,11 @@ object JsonUtils extends LazyLogging { } yield result).get } - def toColumnSeq(json: JsonObject) = { + def toColumnIdSeq(json: JsonObject) = { for { columnsObject <- toJsonObjectSeq("columns", json) columns = sequence(columnsObject.map(hasLong("id", _))) - } yield columns.get + } yield columns } def toColumnValueSeq(json: JsonObject): Seq[Seq[(ColumnId, _)]] = { diff --git a/src/main/scala/com/campudus/tableaux/router/TableauxRouter.scala b/src/main/scala/com/campudus/tableaux/router/TableauxRouter.scala index eafed9bf..d2c98f73 100644 --- a/src/main/scala/com/campudus/tableaux/router/TableauxRouter.scala +++ b/src/main/scala/com/campudus/tableaux/router/TableauxRouter.scala @@ -1,6 +1,7 @@ package com.campudus.tableaux.router import com.campudus.tableaux.{InvalidJsonException, NoJsonFoundException, TableauxConfig} +import com.campudus.tableaux.OkArg import com.campudus.tableaux.controller.TableauxController import com.campudus.tableaux.database.domain.{CellAnnotationType, Pagination} import com.campudus.tableaux.database.model.DuplicateRowOptions @@ -560,8 +561,12 @@ class TableauxRouter(override val config: TableauxConfig, val controller: Tablea val body = Try(getJson(context)).toOption val specificColumnsIds = body.filter(_.containsKey("columns")) - .map(toColumnSeq) - .map(_.get) + .map(toColumnIdSeq) + .flatMap(_.toOption) + .flatMap(_ match { + case OkArg(value) => Some(value) + case _ => None + }) val duplicateOptions = DuplicateRowOptions( getBoolParam("skipConstrainedLinks", context).getOrElse(false), getBoolParam("annotateSkipped", context).getOrElse(false),