From de87da9c9162601eb1df4b6a9e14c7a7e9629609 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 18 Aug 2021 12:40:33 +0200 Subject: [PATCH 1/8] :bug: Fix font uploading issue on windows. --- backend/src/app/rpc/mutations/fonts.clj | 9 +++++++++ frontend/src/app/main/data/fonts.cljs | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/backend/src/app/rpc/mutations/fonts.clj b/backend/src/app/rpc/mutations/fonts.clj index fd3291e6d3..85c604b15d 100644 --- a/backend/src/app/rpc/mutations/fonts.clj +++ b/backend/src/app/rpc/mutations/fonts.clj @@ -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) diff --git a/frontend/src/app/main/data/fonts.cljs b/frontend/src/app/main/data/fonts.cljs index 74872995b0..a8ecf71270 100644 --- a/frontend/src/app/main/data/fonts.cljs +++ b/frontend/src/app/main/data/fonts.cljs @@ -111,10 +111,13 @@ (:data content)}) (dissoc :content))))))) - (parse-mtype [mtype] - (case mtype - "application/vnd.oasis.opendocument.formula-template" "font/otf" - mtype)) + (parse-mtype [ba] + (let [u8 (js/Uint8Array. ba 0 4) + sg (areduce u8 i ret "" (str ret (if (zero? i) "" " ") (.toString (aget u8 i) 8)))] + (case sg + "117 124 124 117" "font/otf" + "0 1 0 0" "font/ttf" + "167 117 106 106" "font/woff"))) (parse-font [{:keys [data] :as params}] (try @@ -128,7 +131,11 @@ (rx/map (fn [data] {:data data :name (.-name blob) - :type (parse-mtype (.-type blob))}))))] + :type (parse-mtype data)})) + (rx/mapcat (fn [{:keys [type] :as font}] + (if type + (rx/of font) + (rx/empty))))))] (->> (rx/from blobs) (rx/mapcat read-blob) From df1fcd5e2222941234db89e856aed69e229b2254 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 18 Aug 2021 15:08:25 +0200 Subject: [PATCH 2/8] :paperclip: Update changelog. --- CHANGES.md | 10 +++++++--- version.txt | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 247d756936..89b5578a24 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,5 @@ # CHANGELOG # - - - ## :rocket: Next ### :sparkles: New features @@ -13,6 +10,13 @@ ### :heart: Community contributions by (Thank you!) +## 1.7.3-alpha + +### :bug: Bugs fixed + +- Fix font uploading issue on Windows. + + ## 1.7.2-alpha ### :sparkles: New features diff --git a/version.txt b/version.txt index e6bff99f22..1f0768e858 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.2-alpha +1.7.3-alpha From c6fe03593913ef194f203676aa5efbcbabd34f90 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 16 Aug 2021 15:46:25 +0200 Subject: [PATCH 3/8] :bug: Fix demo user login issue. --- backend/src/app/rpc/queries/profile.clj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/src/app/rpc/queries/profile.clj b/backend/src/app/rpc/queries/profile.clj index 5e1456c605..41f322881d 100644 --- a/backend/src/app/rpc/queries/profile.clj +++ b/backend/src/app/rpc/queries/profile.clj @@ -92,12 +92,16 @@ profile)) +(def ^:private sql:profile-by-email + "select p.* from profile as p + where p.email = ? + and (p.deleted_at is null or + p.deleted_at > now())") + (defn retrieve-profile-data-by-email [conn email] - (try - (db/get-by-params conn :profile {:email (str/lower email) - :deleted-at nil}) - (catch Exception _e))) + (ex/ignoring + (db/exec-one! conn [sql:profile-by-email (str/lower email)]))) ;; --- Attrs Helpers From 84ba8e6dde465cab5db5c9d3d757dc86b672b830 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 19 Aug 2021 10:44:08 +0200 Subject: [PATCH 4/8] :sparkles: Add better error reporting when ldap is not configured correctly. --- backend/src/app/rpc/mutations/ldap.clj | 20 +++++++++++++++++++- docker/devenv/docker-compose.yaml | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/backend/src/app/rpc/mutations/ldap.clj b/backend/src/app/rpc/mutations/ldap.clj index d327589d89..d982a30b05 100644 --- a/backend/src/app/rpc/mutations/ldap.clj +++ b/backend/src/app/rpc/mutations/ldap.clj @@ -13,11 +13,20 @@ [app.loggers.audit :as audit] [app.rpc.mutations.profile :as profile-m] [app.rpc.queries.profile :as profile-q] + [app.util.logging :as l] [app.util.services :as sv] [clj-ldap.client :as ldap] [clojure.spec.alpha :as s] [clojure.string])) + +(s/def ::fullname ::us/not-empty-string) +(s/def ::email ::us/email) +(s/def ::backend ::us/not-empty-string) + +(s/def ::info-data + (s/keys :req-un [::fullname ::email ::backend])) + (defn ^java.lang.AutoCloseable connect [] (let [params {:ssl? (cfg/get :ldap-ssl) @@ -57,6 +66,13 @@ (ex/raise :type :validation :code :wrong-credentials)) + (when-not (s/valid? ::info-data info) + (let [explain (s/explain-str ::info-data info)] + (l/warn ::l/raw (str "invalid response from ldap, looks like ldap is not configured correctly\n" explain)) + (ex/raise :type :restriction + :code :wrong-ldap-response + :reason explain))) + (let [profile (login-or-register cfg {:email (:email info) :backend (:backend info) :fullname (:fullname info)})] @@ -94,7 +110,9 @@ (cfg/get :ldap-attrs-fullname)] base-dn (cfg/get :ldap-base-dn) - params {:filter query :sizelimit 1 :attributes attrs}] + params {:filter query + :sizelimit 1 + :attributes attrs}] (first (ldap/search cpool base-dn params)))) (defn- authenticate diff --git a/docker/devenv/docker-compose.yaml b/docker/devenv/docker-compose.yaml index b34f56b1ca..c15bd7d00b 100644 --- a/docker/devenv/docker-compose.yaml +++ b/docker/devenv/docker-compose.yaml @@ -92,6 +92,7 @@ services: ports: - "1080:1080" + # https://github.com/rroemhild/docker-test-openldap ldap: image: rroemhild/test-openldap:2.1 expose: From 24da25f0f7c4f48cbb11609ca7bf8f6c86be45b9 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 19 Aug 2021 11:15:30 +0200 Subject: [PATCH 5/8] :paperclip: Update changelog and increase version (minor). --- CHANGES.md | 7 +++++++ version.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 89b5578a24..7ddbee7cb8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,13 @@ ### :boom: Breaking changes ### :heart: Community contributions by (Thank you!) +## 1.7.4-alpha + +### :bug: Bugs fixed + +- Fix demo user creation (self-hosted only) +- Add better ldap response validation and reporting (self-hosted only) + ## 1.7.3-alpha diff --git a/version.txt b/version.txt index 1f0768e858..a303e786bf 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.3-alpha +1.7.4-alpha From 8a158146cd9c95296672f8983023506639ea940c Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 13 Sep 2021 11:10:32 +0200 Subject: [PATCH 6/8] :bug: Fix problem with import broken images --- CHANGES.md | 1 + frontend/src/app/worker/import.cljs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 44f251ba85..d502cc512a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -39,6 +39,7 @@ - Fix problems with order in groups [Taiga #1960](https://tree.taiga.io/project/penpot/issue/1960) - Fix SVG components preview [#1134](https://github.com/penpot/penpot/issues/1134) - Fix group renaming problem [Taiga #1969](https://tree.taiga.io/project/penpot/issue/1969) +- Fix problem with import broken images links [#1197](https://github.com/penpot/penpot/issues/1197) ### :arrow_up: Deps updates ### :boom: Breaking changes diff --git a/frontend/src/app/worker/import.cljs b/frontend/src/app/worker/import.cljs index 5891d4ea47..fc6c8a4c18 100644 --- a/frontend/src/app/worker/import.cljs +++ b/frontend/src/app/worker/import.cljs @@ -255,7 +255,7 @@ (let [name (cip/get-image-name node) data-uri (cip/get-image-data node)] (->> (upload-media-files file-id name data-uri) - (rx/catch #(do (.error js/console %) + (rx/catch #(do (.error js/console "Error uploading media: " name) (rx/of node))) (rx/map (fn [media] @@ -370,7 +370,9 @@ :content content :is-local false}))) (rx/flat-map #(rp/mutation! :upload-file-media-object %)) - (rx/map (constantly media)))))) + (rx/map (constantly media)) + (rx/catch #(do (.error js/console (str "Error uploading media: " (:name media)) ) + (rx/empty))))))) (rx/reduce fb/add-library-media file))) (rx/of file))) From 45d55e87ebfc3bfeb524b7a9080c73105c45004d Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 13 Sep 2021 11:40:06 +0200 Subject: [PATCH 7/8] :bug: Fix problem while moving imported SVG's --- CHANGES.md | 1 + frontend/src/app/main/ui/shapes/attrs.cljs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d502cc512a..0bd13d3057 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -40,6 +40,7 @@ - Fix SVG components preview [#1134](https://github.com/penpot/penpot/issues/1134) - Fix group renaming problem [Taiga #1969](https://tree.taiga.io/project/penpot/issue/1969) - Fix problem with import broken images links [#1197](https://github.com/penpot/penpot/issues/1197) +- Fix problem while moving imported SVG's [#1199](https://github.com/penpot/penpot/issues/1199) ### :arrow_up: Deps updates ### :boom: Breaking changes diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 5185a17edf..973a155a4b 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -159,7 +159,8 @@ id)) svg-attrs (-> svg-attrs (usvg/clean-attrs) - (usvg/update-attr-ids replace-id)) + (usvg/update-attr-ids replace-id) + (dissoc :id)) attrs (-> svg-attrs (dissoc :style) (clj->js)) styles (-> svg-attrs (:style {}) (clj->js))] From 46189c0ff17e191e63912c81081a2621d70cdb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 13 Sep 2021 10:45:55 +0200 Subject: [PATCH 8/8] :bug: Fix wrong timeout in download artboards message --- frontend/src/app/main/ui/workspace/header.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/header.cljs b/frontend/src/app/main/ui/workspace/header.cljs index b50b681b28..5b817509f7 100644 --- a/frontend/src/app/main/ui/workspace/header.cljs +++ b/frontend/src/app/main/ui/workspace/header.cljs @@ -170,7 +170,8 @@ (fn [_] (let [filename (str (:name file) ".pdf") frame-ids (mapv :id frames)] - (st/emit! (dm/info (tr "workspace.options.exporting-object"))) + (st/emit! (dm/info (tr "workspace.options.exporting-object") + {:timeout nil})) (->> (rp/query! :export-frames {:name (:name file) :file-id (:id file)