 
 (defn filename-request-handler
   "Given aws-creds, returns a function handler function which responds to requests for an existing file on AWS."
-  [{:as darwin :keys [params postgres]} request]
-  (let [{:keys [filename zinvite]} params
-        zid (db/get-zid-from-zinvite postgres zinvite)]
+  [{:as darwin :keys [postgres]}
+   {:as request :keys [params]}]
+  (let [{:as params :keys [filename]} (parsed-params darwin params)]
     (if (= (get (get-export-status darwin params) "status") "complete")
       ;; Have to think about the security repercussions here. Would be nice if we could stream this and never
       ;; expose the link here. XXX


;; General helpers..

(def respond-404
  {:status 404
   :headers {"Content-Type" "text/plain"}
   :body "Unknown, incomplete or expired conversation export"})


;; Requests for exported files in aws.


(defn run-datadump
  "Based on params this actually runs the export-conversation computation."
  [darwin {:as params :keys [filename]}]
  (log/info "Params for run-datadump are:" (with-out-str (prn params)))
  (try
    (let [;; The dissoc is just a vague security measure
