From 88a33d809cc930a86cff28826a3032ae7c85dd4a Mon Sep 17 00:00:00 2001 From: Santeri Korri Date: Thu, 9 May 2024 14:26:00 +0300 Subject: [PATCH 1/2] =?UTF-8?q?OY-4829=20L=C3=A4hetet=C3=A4=C3=A4n=20Bucke?= =?UTF-8?q?tAV:lle=20maksimissaan=2010=20tiedostoa=20kerrallaan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/liiteri/virus_scan.clj | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/liiteri/virus_scan.clj b/src/liiteri/virus_scan.clj index af0c60a..17832ba 100644 --- a/src/liiteri/virus_scan.clj +++ b/src/liiteri/virus_scan.clj @@ -105,15 +105,16 @@ (when (not-empty metadata) (doseq [file metadata] (log/info (str "Requesting file scan for " (:key file) ", to bucket " (:s3-bucket this)))) - (.sendMessage (:sqs-request-scan-client this) (:request-queue-url this) - (json/generate-string {:objects - (map (fn [file] - {:bucket (:s3-bucket this) - :key (:key file) - :custom_data (json/generate-string {:start-time (System/currentTimeMillis) - :filename (:filename file) - :content-type (:content-type file)})}) - metadata)}))))) + (doseq [metadatapart (partition 10 10 [] metadata)] ; BucketAV hyväksyy maksimissaan 10 tiedostoa kerrallaan + (.sendMessage (:sqs-request-scan-client this) (:request-queue-url this) + (json/generate-string {:objects + (map (fn [file] + {:bucket (:s3-bucket this) + :key (:key file) + :custom_data (json/generate-string {:start-time (System/currentTimeMillis) + :filename (:filename file) + :content-type (:content-type file)})}) + metadatapart)})))))) (defn new-scanner [] (map->VirusScanner {})) From dcc89ee9f21ecdb6a36b4bd547a7de1c9c98fca0 Mon Sep 17 00:00:00 2001 From: Santeri Korri Date: Fri, 10 May 2024 11:56:21 +0300 Subject: [PATCH 2/2] =?UTF-8?q?OY-4829=20Lis=C3=A4t=C3=A4=C3=A4n=20mahdoll?= =?UTF-8?q?isuus=20finalisoida=20tiedosto=20uudestaan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/liiteri/api.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/liiteri/api.clj b/src/liiteri/api.clj index fd4502d..1b86018 100644 --- a/src/liiteri/api.clj +++ b/src/liiteri/api.clj @@ -93,13 +93,14 @@ :header-params [{x-real-ip :- s/Str nil} {user-agent :- s/Str nil}] :query-params [{origin-system :- (api/describe (s/maybe s/Str) "Origin system - for example Ataru - optional") "tuntematon"} - {origin-reference :- (api/describe (s/maybe s/Str) "Origin reference - for example Application key - optional") "tuntematon"}] + {origin-reference :- (api/describe (s/maybe s/Str) "Origin reference - for example Application key - optional") "tuntematon"} + {refinalize :- (api/describe (s/maybe s/Bool) "Refinalize - run finalization even if file already finalized - optional") "tuntematon"}] :body-params [keys :- [s/Str]] (check-authorization! session) (when (> (count keys) 0) (let [metadata (file-metadata-store/get-metadata keys {:connection db})] (file-metadata-store/finalize-files keys origin-system origin-reference {:connection db}) - (virus-scan/request-file-scan virus-scan (filter (fn [item] (not (:final item))) metadata)) + (virus-scan/request-file-scan virus-scan (filter (fn [item] (or (true? refinalize) (not (:final item)))) metadata)) (doseq [{key :key} metadata] (audit-log/log audit-logger (audit-log/user session x-real-ip user-agent)