in api/src/main/scala/com/gu/core/store/store.scala [272:286]
private[this] def deletePrivateAvatarFiles(buckets: Seq[String], avatarIds: List[String]): Either[Error, List[String]] = {
val paths = avatarIds.map(KVLocationFromID.apply)
val zero: Either[Error, List[String]] = Right(List())
buckets.foldLeft(zero) { (acc, bucket) =>
acc match {
case Right(locAcc) => {
val locations = paths.map(path => s"$bucket/$path")
val res = fs.delete(bucket, paths: _*).map(_ => locations)
res.map(_ ::: locAcc)
}
case error => error
}
}
}