🐛 Fix font uploading issue on windows.

This commit is contained in:
Andrey Antukh 2021-08-18 12:40:33 +02:00 committed by Andrés Moya
parent a9cf4dad82
commit 3532263af4
2 changed files with 21 additions and 5 deletions

View file

@ -6,6 +6,7 @@
(ns app.rpc.mutations.fonts
(:require
[app.common.exceptions :as ex]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.config :as cf]
@ -49,6 +50,7 @@
(let [data (media/run cfg {:cmd :generate-fonts :input data :rlimit :font})
storage (media/configure-assets-storage storage conn)
otf (when-let [fdata (get data "font/otf")]
(sto/put-object storage {:content (sto/content fdata)
:content-type "font/otf"}))
@ -65,6 +67,13 @@
(sto/put-object storage {:content (sto/content fdata)
:content-type "font/woff2"}))]
(when (and (nil? otf)
(nil? ttf)
(nil? woff1)
(nil? woff2))
(ex/raise :type :validation
:code :invalid-font-upload))
(db/insert! conn :team-font-variant
{:id (uuid/next)
:team-id (:team-id params)