content lengths specified.

This commit is contained in:
2022-07-12 06:34:52 -07:00
parent bb6592bd71
commit ab51d77384
7 changed files with 25 additions and 17 deletions

View File

@@ -62,7 +62,8 @@
_ (s3/put-object :bucket-name (:data-bucket env) _ (s3/put-object :bucket-name (:data-bucket env)
:key s3-location :key s3-location
:input-stream (io/input-stream filename) :input-stream (io/input-stream filename)
:metadata {:content-type "application/pdf"}) :metadata {:content-type "application/pdf"
:content-length (.length (io/file filename))})
imports (->> (parse/parse-file filename filename) imports (->> (parse/parse-file filename filename)
(map #(assoc % (map #(assoc %
:source-url (str "http://" (:data-bucket env) :source-url (str "http://" (:data-bucket env)

View File

@@ -181,17 +181,19 @@
(defn make-pdfs [checks] (defn make-pdfs [checks]
(loop [[check & checks] checks] (loop [[check & checks] checks]
(when check (when check
(s3/put-object :bucket-name (:data-bucket env) (let [check-bytes (-> check
:key (:payment/s3-key check) :payment/pdf-data
:input-stream (-> check (edn/read-string)
:payment/pdf-data
(edn/read-string)
make-check-pdf make-check-pdf
(io/make-input-stream {})) )]
:metadata {:content-type "application/pdf"}) (s3/put-object :bucket-name (:data-bucket env)
:key (:payment/s3-key check)
:input-stream (io/make-input-stream check-bytes {})
:metadata {:content-type "application/pdf"
:content-length (count check-bytes)}))
(recur checks)))) (recur checks))))
(defn merge-pdfs [keys] (defn merge-pdfs [keys]

View File

@@ -40,7 +40,8 @@
(s3/put-object :bucket-name "integreat-signature-images" #_(:data-bucket env) (s3/put-object :bucket-name "integreat-signature-images" #_(:data-bucket env)
:key (str signature-id ".jpg") :key (str signature-id ".jpg")
:input-stream (io/make-input-stream raw-bytes {}) :input-stream (io/make-input-stream raw-bytes {})
:metadata {:content-type "image/jpeg"} :metadata {:content-type "image/jpeg"
:content-length (count raw-bytes)}
:canned-acl "public-read") :canned-acl "public-read")
(str "https://integreat-signature-images.s3.amazonaws.com/" signature-id ".jpg"))))) (str "https://integreat-signature-images.s3.amazonaws.com/" signature-id ".jpg")))))

View File

@@ -230,7 +230,6 @@
(try (try
(f entry) (f entry)
(catch Exception e (catch Exception e
(log/warn (.getMessage e))
(assoc entry :error (.getMessage e) (assoc entry :error (.getMessage e)
:status (or (:status (ex-data e)) :status (or (:status (ex-data e))
:error)))))) :error))))))

View File

@@ -48,12 +48,14 @@
(s3/put-object :bucket-name (:data-bucket env) (s3/put-object :bucket-name (:data-bucket env)
:key (str "intuit/access-token") :key (str "intuit/access-token")
:input-stream (io/make-input-stream (.getBytes t) {}) :input-stream (io/make-input-stream (.getBytes t) {})
:metadata {:content-type "application/text"})) :metadata {:content-type "application/text"
:content-length (count (.getBytes t))}))
(defn set-refresh-token [t] (defn set-refresh-token [t]
(s3/put-object :bucket-name (:data-bucket env) (s3/put-object :bucket-name (:data-bucket env)
:key (str "intuit/refresh-token") :key (str "intuit/refresh-token")
:input-stream (io/make-input-stream (.getBytes t) {}) :input-stream (io/make-input-stream (.getBytes t) {})
:metadata {:content-type "application/text"})) :metadata {:content-type "application/text"
:content-length (count (.getBytes t))}))
(defn copy-prod-refresh-token [] (defn copy-prod-refresh-token []
(set-refresh-token (slurp (:object-content (s3/get-object (set-refresh-token (slurp (:object-content (s3/get-object

View File

@@ -420,13 +420,15 @@
(Long/parseLong)) (Long/parseLong))
{:keys [filename tempfile]} files] {:keys [filename tempfile]} files]
(lc/with-context {:parsing-file filename} (lc/with-context {:parsing-file filename}
(log/info tempfile)
(try (try
(let [extension (last (str/split (.getName (io/file filename)) #"\.")) (let [extension (last (str/split (.getName (io/file filename)) #"\."))
s3-location (str "invoice-files/" (str (UUID/randomUUID)) "." extension) s3-location (str "invoice-files/" (str (UUID/randomUUID)) "." extension)
_ (s3/put-object :bucket-name (:data-bucket env) _ (s3/put-object (:data-bucket env)
:key s3-location s3-location
:input-stream (io/input-stream tempfile) (io/input-stream tempfile)
:metadata {:content-type "application/pdf"}) {:content-type "application/pdf"
:content-length (.length tempfile)})
imports (->> (parse/parse-file (.getPath tempfile) filename) imports (->> (parse/parse-file (.getPath tempfile) filename)
(map #(assoc % (map #(assoc %
:client-override client :client-override client

View File

@@ -54,6 +54,7 @@
:key (str "queries/" guid) :key (str "queries/" guid)
:input-stream (io/make-input-stream (.getBytes body) {}) :input-stream (io/make-input-stream (.getBytes body) {})
:metadata {:content-type "application/text" :metadata {:content-type "application/text"
:content-length (count (.getBytes body))
:user-metadata {:note note}}) :user-metadata {:note note}})
{:body {:query body {:body {:query body
:id guid :id guid