0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

🐛 Fix content-length handling on exporter

This commit is contained in:
Andrey Antukh 2022-09-27 13:15:59 +02:00
parent 1dc493c2d5
commit 84655c0fa3
3 changed files with 11 additions and 7 deletions

View file

@ -9,7 +9,7 @@
["process" :as proc]
[app.browser :as bwr]
[app.common.logging :as l]
[app.config]
[app.config :as cf]
[app.http :as http]
[app.redis :as redis]
[promesa.core :as p]))
@ -19,7 +19,9 @@
(defn start
[& _]
(l/info :msg "initializing")
(l/info :msg "initializing"
:public-uri (str (cf/get :public-uri))
:version (:full @cf/version))
(p/do!
(bwr/init)
(redis/init)
@ -39,5 +41,6 @@
(http/stop)
(done)))
(proc/on "uncaughtException" (fn [cause]
(js/console.error cause)))
(proc/on "uncaughtException"
(fn [cause]
(js/console.error cause)))

View file

@ -77,7 +77,7 @@
:name (:name resource)
:status "ended"}))))
on-error (fn [cause]
(l/error :hint "unexpected error happened on export multiple process"
(l/error :hint "unexpected error on export multiple"
:cause cause)
(if wait
(p/rejected cause)

View file

@ -90,12 +90,13 @@
(fn [{:keys [:response/body :response/status] :as exchange}]
(cond
(map? body)
(let [data (t/encode-str body {:type :json-verbose})]
(let [data (t/encode-str body {:type :json-verbose})
size (js/Buffer.byteLength data "utf-8")]
(-> exchange
(assoc :response/body data)
(assoc :response/status 200)
(update :response/headers assoc "content-type" "application/transit+json")
(update :response/headers assoc "content-length" (count data))))
(update :response/headers assoc "content-length" size)))
(and (nil? body)
(= 200 status))