diff --git a/mongo/src/MongoJsonRepository.scala b/mongo/src/MongoJsonRepository.scala index c6d3487..b40c3e4 100644 --- a/mongo/src/MongoJsonRepository.scala +++ b/mongo/src/MongoJsonRepository.scala @@ -97,7 +97,7 @@ def find(id: String): Task[Option[Array[Byte]]] = ZIO .fromFuture(_ => bucket.downloadToObservable(ObjectId(id)).toFuture) - .map(_.headOption.map(_.array)) + .map(r => if r.isEmpty then None else Some(r.map(_.array).reduce(_ ++ _))) def matching(criteria: Criteria): Task[List[MongoFile]] = ZIO