From b2787b47328e41134dfbc299bfa5f2b9dc52134a Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Wed, 7 Dec 2022 22:11:14 -0800 Subject: [PATCH] final. --- src/clj/auto_ap/routes/exports.clj | 6 ++++-- src/cljs/auto_ap/views/pages/company/other.cljs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/clj/auto_ap/routes/exports.clj b/src/clj/auto_ap/routes/exports.clj index 21ccbbce..5592b21f 100644 --- a/src/clj/auto_ap/routes/exports.clj +++ b/src/clj/auto_ap/routes/exports.clj @@ -256,8 +256,10 @@ (into [["Vendor Name" "Address" "City" "State" "Zip" "Terms" "Account" "Account Code"]]))] {:body (with-open [w (java.io.StringWriter.)] - (csv/write-csv w data) - (.toString w))}))) + (csv/write-csv w data + :quote? (constantly true)) + (.toString w)) + :headers {"Content-Type" "application/csv"}}))) (GET "/ledger/export" {:keys [identity query-params]} (let [start-date (or (some-> (query-params "start-date") (atime/parse atime/iso-date)) diff --git a/src/cljs/auto_ap/views/pages/company/other.cljs b/src/cljs/auto_ap/views/pages/company/other.cljs index c676a4d3..1ee7fbc2 100644 --- a/src/cljs/auto_ap/views/pages/company/other.cljs +++ b/src/cljs/auto_ap/views/pages/company/other.cljs @@ -8,7 +8,8 @@ [re-frame.core :as re-frame] [reagent.core :as reagent] [vimsical.re-frame.cofx.inject :as inject] - [auto-ap.status :as status])) + [auto-ap.status :as status] + [clojure.string :as str])) (re-frame/reg-event-fx ::ready @@ -58,7 +59,7 @@ [:<> [:div "Ready! Click " - [:a {:href (str "data:attachment/csv;charset=utf-8," (js/encodeURI export-result)) + [:a {:href (str "data:attachment/csv;charset=utf-8,%EF%BB%BF" (js/encodeURI (str/replace export-result "#" "Number "))) :target "_blank" :download (str "vendors-" (:code client) ".csv")} "here"]