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)
:key s3-location
: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)
(map #(assoc %
:source-url (str "http://" (:data-bucket env)

View File

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

View File

@@ -40,7 +40,8 @@
(s3/put-object :bucket-name "integreat-signature-images" #_(:data-bucket env)
:key (str signature-id ".jpg")
: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")
(str "https://integreat-signature-images.s3.amazonaws.com/" signature-id ".jpg")))))

View File

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

View File

@@ -48,12 +48,14 @@
(s3/put-object :bucket-name (:data-bucket env)
:key (str "intuit/access-token")
: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]
(s3/put-object :bucket-name (:data-bucket env)
:key (str "intuit/refresh-token")
: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 []
(set-refresh-token (slurp (:object-content (s3/get-object

View File

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

View File

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