Improve url resolution on assets handlers.

This commit is contained in:
Andrey Antukh 2021-01-25 16:14:06 +01:00 committed by Hirunatan
parent d68286821b
commit 340d1d43be

View file

@ -65,12 +65,7 @@
:fs :fs
(let [purl (u/uri (:public-uri cfg)) (let [purl (u/uri (:public-uri cfg))
path (sto/object->path obj) purl (u/join purl (sto/object->relative-path obj))]
purl (update purl :path
(fn [existing]
(if (str/ends-with? existing "/")
(str existing path)
(str existing "/" path))))]
{:status 204 {:status 204
:headers {"x-accel-redirect" (:path purl) :headers {"x-accel-redirect" (:path purl)
"content-type" (:content-type mdata) "content-type" (:content-type mdata)