mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Return a 404 if a source was not found when checking a file
This commit is contained in:
@ -55,7 +55,7 @@ trait OItemSearch[F[_]] {
|
||||
|
||||
def findByFileCollective(checksum: String, collective: Ident): F[Vector[RItem]]
|
||||
|
||||
def findByFileSource(checksum: String, sourceId: Ident): F[Vector[RItem]]
|
||||
def findByFileSource(checksum: String, sourceId: Ident): F[Option[Vector[RItem]]]
|
||||
|
||||
}
|
||||
|
||||
@ -280,11 +280,11 @@ object OItemSearch {
|
||||
def findByFileCollective(checksum: String, collective: Ident): F[Vector[RItem]] =
|
||||
store.transact(QItem.findByChecksum(checksum, collective, Set.empty))
|
||||
|
||||
def findByFileSource(checksum: String, sourceId: Ident): F[Vector[RItem]] =
|
||||
def findByFileSource(checksum: String, sourceId: Ident): F[Option[Vector[RItem]]] =
|
||||
store.transact((for {
|
||||
coll <- OptionT(RSource.findCollective(sourceId))
|
||||
items <- OptionT.liftF(QItem.findByChecksum(checksum, coll, Set.empty))
|
||||
} yield items).getOrElse(Vector.empty))
|
||||
} yield items).value)
|
||||
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user