mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
🐛 Fix content-length handling on exporter
This commit is contained in:
parent
1dc493c2d5
commit
84655c0fa3
3 changed files with 11 additions and 7 deletions
|
@ -9,7 +9,7 @@
|
||||||
["process" :as proc]
|
["process" :as proc]
|
||||||
[app.browser :as bwr]
|
[app.browser :as bwr]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.config]
|
[app.config :as cf]
|
||||||
[app.http :as http]
|
[app.http :as http]
|
||||||
[app.redis :as redis]
|
[app.redis :as redis]
|
||||||
[promesa.core :as p]))
|
[promesa.core :as p]))
|
||||||
|
@ -19,7 +19,9 @@
|
||||||
|
|
||||||
(defn start
|
(defn start
|
||||||
[& _]
|
[& _]
|
||||||
(l/info :msg "initializing")
|
(l/info :msg "initializing"
|
||||||
|
:public-uri (str (cf/get :public-uri))
|
||||||
|
:version (:full @cf/version))
|
||||||
(p/do!
|
(p/do!
|
||||||
(bwr/init)
|
(bwr/init)
|
||||||
(redis/init)
|
(redis/init)
|
||||||
|
@ -39,5 +41,6 @@
|
||||||
(http/stop)
|
(http/stop)
|
||||||
(done)))
|
(done)))
|
||||||
|
|
||||||
(proc/on "uncaughtException" (fn [cause]
|
(proc/on "uncaughtException"
|
||||||
(js/console.error cause)))
|
(fn [cause]
|
||||||
|
(js/console.error cause)))
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
:name (:name resource)
|
:name (:name resource)
|
||||||
:status "ended"}))))
|
:status "ended"}))))
|
||||||
on-error (fn [cause]
|
on-error (fn [cause]
|
||||||
(l/error :hint "unexpected error happened on export multiple process"
|
(l/error :hint "unexpected error on export multiple"
|
||||||
:cause cause)
|
:cause cause)
|
||||||
(if wait
|
(if wait
|
||||||
(p/rejected cause)
|
(p/rejected cause)
|
||||||
|
|
|
@ -90,12 +90,13 @@
|
||||||
(fn [{:keys [:response/body :response/status] :as exchange}]
|
(fn [{:keys [:response/body :response/status] :as exchange}]
|
||||||
(cond
|
(cond
|
||||||
(map? body)
|
(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
|
(-> exchange
|
||||||
(assoc :response/body data)
|
(assoc :response/body data)
|
||||||
(assoc :response/status 200)
|
(assoc :response/status 200)
|
||||||
(update :response/headers assoc "content-type" "application/transit+json")
|
(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)
|
(and (nil? body)
|
||||||
(= 200 status))
|
(= 200 status))
|
||||||
|
|
Loading…
Add table
Reference in a new issue