diff --git a/ScalliGraph b/ScalliGraph index 3069fcc626..837d461fc1 160000 --- a/ScalliGraph +++ b/ScalliGraph @@ -1 +1 @@ -Subproject commit 3069fcc62619fe5063d354acde42e5e999f22317 +Subproject commit 837d461fc13908a1aabb3712baee7c5f37e7a55f diff --git a/thehive/app/org/thp/thehive/services/AttachmentSrv.scala b/thehive/app/org/thp/thehive/services/AttachmentSrv.scala index 9f70d36a78..4bb209f105 100644 --- a/thehive/app/org/thp/thehive/services/AttachmentSrv.scala +++ b/thehive/app/org/thp/thehive/services/AttachmentSrv.scala @@ -33,12 +33,10 @@ class AttachmentSrv @Inject() (configuration: Configuration, storageSrv: Storage val hs = hashers.fromPath(file.filepath) val id = hs.head.toString val is = Files.newInputStream(file.filepath) - val result = - storageSrv - .saveBinary("attachment", id, is) - .flatMap(_ => createEntity(Attachment(file.filename, Files.size(file.filepath), file.contentType, hs, id))) - is.close() - result + try storageSrv + .saveBinary("attachment", id, is) + .flatMap(_ => createEntity(Attachment(file.filename, Files.size(file.filepath), file.contentType, hs, id))) + finally is.close() } def create(filename: String, contentType: String, data: Array[Byte])(implicit