Skip to content

Commit

Permalink
#1718 Fix duplication checks when creating an observable
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Dec 21, 2020
1 parent 0505275 commit 5b1af82
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions thehive/app/org/thp/thehive/services/CaseSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,8 @@ class CaseSrv @Inject() (
authContext: AuthContext
): Try[Unit] = {
val alreadyExistInThatCase = richObservable
.dataOrAttachment
.fold(
_ =>
observableSrv
.get(richObservable.observable)
.filteredSimilar
.visible
.`case`
.hasId(`case`._id)
.exists,
attachment => get(`case`).share.observables.attachments.has(_.attachmentId, attachment.attachmentId).exists
) || get(`case`).observables.filter(_.hasId(richObservable.observable._id)).exists
.data
.fold(false)(data => get(`case`).observables.data.has(_.data, data.data).exists)

if (alreadyExistInThatCase)
Failure(CreateError("Observable already exists"))
Expand Down

0 comments on commit 5b1af82

Please sign in to comment.