From 6db3c6cf89a971faeb323762b03455608cd54abf Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 26 Mar 2026 15:43:30 +0100 Subject: [PATCH] :bug: Fix regression on subpath support (#8793) --- docker/devenv/files/Caddyfile | 4 ++++ frontend/src/app/config.cljs | 11 +++++------ frontend/src/app/main/ui/dashboard/templates.cljs | 7 ++++--- frontend/src/app/render_wasm/api/fonts.cljs | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docker/devenv/files/Caddyfile b/docker/devenv/files/Caddyfile index eb822a91c3..eda140d5e9 100644 --- a/docker/devenv/files/Caddyfile +++ b/docker/devenv/files/Caddyfile @@ -9,6 +9,10 @@ localhost:3449 { } http://localhost:3450 { + # For subpath test + # handle_path /penpot/* { + # reverse_proxy localhost:4449 + # } reverse_proxy localhost:4449 } diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index c32c76bbb8..a0c5680204 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -179,12 +179,11 @@ ([media] (resolve-file-media media false)) ([{:keys [id data-uri] :as media} thumbnail?] - (if data-uri - data-uri - (dm/str - (cond-> (u/join public-uri "assets/by-file-media-id/") - (true? thumbnail?) (u/join (dm/str id "/thumbnail")) - (false? thumbnail?) (u/join (dm/str id))))))) + (or data-uri + (dm/str + (cond-> (u/join public-uri "assets/by-file-media-id/") + (true? thumbnail?) (u/join (dm/str id "/thumbnail")) + (false? thumbnail?) (u/join (dm/str id))))))) (defn resolve-href [resource] diff --git a/frontend/src/app/main/ui/dashboard/templates.cljs b/frontend/src/app/main/ui/dashboard/templates.cljs index ece2e146cf..d5f84c2862 100644 --- a/frontend/src/app/main/ui/dashboard/templates.cljs +++ b/frontend/src/app/main/ui/dashboard/templates.cljs @@ -8,6 +8,7 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data.macros :as dm] + [app.common.uri :as u] [app.config :as cf] [app.main.data.common :as dcm] [app.main.data.dashboard :as dd] @@ -95,8 +96,8 @@ (mf/defc card-item {::mf/wrap-props false} [{:keys [item index is-visible collapsed on-import]}] - (let [id (dm/str "card-container-" index) - thb (assoc cf/public-uri :path (dm/str "/images/thumbnails/template-" (:id item) ".jpg")) + (let [id (dm/str "card-container-" index) + href (u/join cf/public-uri (dm/str "images/thumbnails/template-" (:id item) ".jpg")) hover? (mf/use-state false) on-click @@ -124,7 +125,7 @@ :on-mouse-leave #(reset! hover? false) :on-key-down on-key-down} [:div {:class (stl/css :img-container)} - [:img {:src (dm/str thb) + [:img {:src (dm/str href) :alt (:name item) :loading "lazy" :decoding "async"}]] diff --git a/frontend/src/app/render_wasm/api/fonts.cljs b/frontend/src/app/render_wasm/api/fonts.cljs index 8c73f85e2d..d8db746764 100644 --- a/frontend/src/app/render_wasm/api/fonts.cljs +++ b/frontend/src/app/render_wasm/api/fonts.cljs @@ -32,7 +32,7 @@ (defn- google-font-id->uuid "Returns the UUID for a Google Font ID. Uses uuid/zero as fallback when the - font is not found in fontsdb. uuid/zero maps to the default font (Source + font is not found in fontsdb. uuid/zero maps to the default font (Source Sans Pro) in WASM. A font id may not exist for different reasons: - the gfonts.json catalog was updated and fonts were renamed or removed, @@ -152,7 +152,7 @@ [font-id font-variant-id font-weight font-style] (let [variant (font-db-data font-id font-variant-id font-weight font-style)] (if-let [ttf-url (:ttf-url variant)] - (str/replace ttf-url "https://fonts.gstatic.com/s/" (u/join cf/public-uri "/internal/gfonts/font/")) + (str/replace ttf-url "https://fonts.gstatic.com/s/" (u/join cf/public-uri "internal/gfonts/font/")) nil))) (defn- font-id->ttf-url