mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 00:58:26 -05:00
🐛 Fix importation on debug endpoint
This commit is contained in:
parent
f30732dc7f
commit
2a6022fa18
1 changed files with 12 additions and 10 deletions
|
@ -133,7 +133,7 @@
|
||||||
[{:keys [::db/pool]} {:keys [::session/profile-id params] :as request}]
|
[{:keys [::db/pool]} {:keys [::session/profile-id params] :as request}]
|
||||||
(let [profile (profile/get-profile pool profile-id)
|
(let [profile (profile/get-profile pool profile-id)
|
||||||
project-id (:default-project-id profile)
|
project-id (:default-project-id profile)
|
||||||
data (some-> params :file :path io/read-as-bytes blob/decode)]
|
data (some-> params :file :path io/read-as-bytes)]
|
||||||
|
|
||||||
(if (and data project-id)
|
(if (and data project-id)
|
||||||
(let [fname (str "Imported file *: " (dt/now))
|
(let [fname (str "Imported file *: " (dt/now))
|
||||||
|
@ -145,19 +145,21 @@
|
||||||
(is-file-exists? pool file-id))
|
(is-file-exists? pool file-id))
|
||||||
(do
|
(do
|
||||||
(db/update! pool :file
|
(db/update! pool :file
|
||||||
{:data (blob/encode data)}
|
{:data data}
|
||||||
{:id file-id})
|
{:id file-id})
|
||||||
{::yrs/status 200
|
{::yrs/status 200
|
||||||
::yrs/body "OK UPDATED"})
|
::yrs/body "OK UPDATED"})
|
||||||
|
|
||||||
(do
|
(db/run! pool (fn [{:keys [::db/conn]}]
|
||||||
(create-file pool {:id file-id
|
(create-file conn {:id file-id
|
||||||
:name fname
|
:name fname
|
||||||
:project-id project-id
|
:project-id project-id
|
||||||
:profile-id profile-id
|
:profile-id profile-id})
|
||||||
:data data})
|
(db/update! conn :file
|
||||||
{::yrs/status 201
|
{:data data}
|
||||||
::yrs/body "OK CREATED"})))
|
{:id file-id})
|
||||||
|
{::yrs/status 201
|
||||||
|
::yrs/body "OK CREATED"}))))
|
||||||
|
|
||||||
{::yrs/status 500
|
{::yrs/status 500
|
||||||
::yrs/body "ERROR"})))
|
::yrs/body "ERROR"})))
|
||||||
|
|
Loading…
Add table
Reference in a new issue