should prevent bad error message from uploaded invoices.
This commit is contained in:
@@ -20,9 +20,7 @@
|
||||
|
||||
(defn send-email-about-failed-message [mail-bucket mail-key message]
|
||||
(let [target-key (str "failed-emails/" mail-key ".eml")
|
||||
target-url (str "http://" (:data-bucket env)
|
||||
".s3-website-us-east-1.amazonaws.com/"
|
||||
target-key)]
|
||||
target-url (str "https://" (:data-bucket env) "/" target-key)]
|
||||
(alog/info ::sending-failure-email :who (:import-failure-destination-emails env))
|
||||
(s3/copy-object mail-bucket mail-key (:data-bucket env) target-key)
|
||||
(ses/send-email {:destination {:to-addresses (:import-failure-destination-emails env)}
|
||||
@@ -66,8 +64,8 @@
|
||||
:content-length (.length (io/file filename))})
|
||||
(let [imports (->> (parse/parse-file filename filename)
|
||||
(map #(assoc %
|
||||
:source-url (str "http://" (:data-bucket env)
|
||||
".s3-website-us-east-1.amazonaws.com/"
|
||||
:source-url (str "https://" (:data-bucket env)
|
||||
"/"
|
||||
s3-location)
|
||||
:import-status :import-status/imported)))]
|
||||
(alog/info ::found-imports :imports imports)
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
(mapcat (fn [k]
|
||||
(try
|
||||
(let [invoice-key (copy-readable-version k)
|
||||
invoice-url (str "http://" bucket-name ".s3-website-us-east-1.amazonaws.com/" invoice-key)]
|
||||
invoice-url (str "https://" bucket-name "/" invoice-key)]
|
||||
(with-open [is (-> (s3/get-object {:bucket-name bucket-name
|
||||
:key k})
|
||||
:input-stream)]
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
(mapcat (fn [k]
|
||||
(try
|
||||
(let [invoice-key (str "invoice-files/" (UUID/randomUUID) ".csv") ;
|
||||
invoice-url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/" invoice-key)]
|
||||
invoice-url (str "https://" (:data-bucket env) "/" invoice-key)]
|
||||
(s3/copy-object {:source-bucket-name (:data-bucket env)
|
||||
:destination-bucket-name (:data-bucket env)
|
||||
:source-key k
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
pdf-data (make-pnl args data)
|
||||
name (pnl-args->name args)
|
||||
key (str "reports/pnl/" uuid "/" name ".pdf")
|
||||
url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/" key)]
|
||||
url (str "https://" (:data-bucket env) "/" key)]
|
||||
(s3/put-object :bucket-name (:data-bucket env)
|
||||
:key key
|
||||
:input-stream (io/make-input-stream pdf-data {})
|
||||
@@ -359,7 +359,7 @@
|
||||
pdf-data (make-cash-flows args data)
|
||||
name (cash-flows-args->name args)
|
||||
key (str "reports/cash-flows/" uuid "/" name ".pdf")
|
||||
url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/" key)]
|
||||
url (str "https://" (:data-bucket env) "/" key)]
|
||||
(s3/put-object :bucket-name (:data-bucket env)
|
||||
:key key
|
||||
:input-stream (io/make-input-stream pdf-data {})
|
||||
@@ -380,7 +380,7 @@
|
||||
pdf-data (make-balance-sheet args data)
|
||||
name (balance-sheet-args->name args)
|
||||
key (str "reports/balance-sheet/" uuid "/" name ".pdf")
|
||||
url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/" key)]
|
||||
url (str "https://" (:data-bucket env) "/" key)]
|
||||
(s3/put-object :bucket-name (:data-bucket env)
|
||||
:key key
|
||||
:input-stream (io/make-input-stream pdf-data {})
|
||||
@@ -401,7 +401,7 @@
|
||||
pdf-data (make-journal-detail-report args data)
|
||||
name (journal-detail-args->name args)
|
||||
key (str "reports/journal-detail/" uuid "/" name ".pdf")
|
||||
url (str "http://" (:data-bucket env) ".s3-website-us-east-1.amazonaws.com/" key)]
|
||||
url (str "https://" (:data-bucket env) "/" key)]
|
||||
(s3/put-object :bucket-name (:data-bucket env)
|
||||
:key key
|
||||
:input-stream (io/make-input-stream pdf-data {})
|
||||
|
||||
@@ -277,8 +277,8 @@
|
||||
:client-override client
|
||||
:location-override location
|
||||
:vendor-override vendor
|
||||
:source-url (str "http://" (:data-bucket env)
|
||||
".s3-website-us-east-1.amazonaws.com/"
|
||||
:source-url (str "https://" (:data-bucket env)
|
||||
"/"
|
||||
s3-location))))]
|
||||
(import-uploaded-invoice user imports))
|
||||
{:status 200
|
||||
|
||||
Reference in New Issue
Block a user