From 93b9f5c567fdd8fb86254b8fa77b989fb2325554 Mon Sep 17 00:00:00 2001 From: Miguel de Benito Delgado Date: Thu, 18 Jun 2026 18:14:56 +0200 Subject: [PATCH] :bug: Follow 302 redirects when downloading templates (#10308) * :lipstick: Update URIs for templates to avoid redirects * :bug: Follow 302 redirects when downloading templates --- backend/resources/app/onboarding.edn | 30 ++++++++++++++-------------- backend/src/app/setup/templates.clj | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/backend/resources/app/onboarding.edn b/backend/resources/app/onboarding.edn index 78d5ddf4c1..d70e85a1fc 100644 --- a/backend/resources/app/onboarding.edn +++ b/backend/resources/app/onboarding.edn @@ -1,45 +1,45 @@ [{:id "tokens-starter-kit" :name "Design tokens starter kit" - :file-uri "https://github.com/penpot/penpot-files/raw/refs/heads/main/Tokens%20starter%20kit.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/refs/heads/main/Tokens%20starter%20kit.penpot"} {:id "penpot-design-system" :name "Penpot Design System | Pencil" - :file-uri "https://github.com/penpot/penpot-files/raw/refs/heads/main/Pencil-Penpot-Design-System.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/refs/heads/main/Pencil-Penpot-Design-System.penpot"} {:id "wireframing-kit" :name "Wireframe library" - :file-uri "https://github.com/penpot/penpot-files/raw/refs/heads/main/Wireframing%20kit%20v1.1.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/refs/heads/main/Wireframing%20kit%20v1.1.penpot"} {:id "prototype-examples" :name "Prototype template" - :file-uri "https://github.com/penpot/penpot-files/raw/refs/heads/main/Prototype%20examples%20v1.1.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/refs/heads/main/Prototype%20examples%20v1.1.penpot"} {:id "plants-app" :name "UI mockup example" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Plants-app.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Plants-app.penpot"} {:id "tutorial-for-beginners" :name "Tutorial for beginners" - :file-uri "https://github.com/penpot/penpot-files/raw/main/tutorial-for-beginners.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/tutorial-for-beginners.penpot"} {:id "lucide-icons" :name "Lucide Icons" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Lucide-icons.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Lucide-icons.penpot"} {:id "font-awesome" :name "Font Awesome" - :file-uri "https://github.com/penpot/penpot-files/raw/main/FontAwesome.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/FontAwesome.penpot"} {:id "black-white-mobile-templates" :name "Black & White Mobile Templates" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Black-&-White-Mobile-Templates.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Black-&-White-Mobile-Templates.penpot"} {:id "avataaars" :name "Avataaars" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Avataaars-by-Pablo-Stanley.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Avataaars-by-Pablo-Stanley.penpot"} {:id "ux-notes" :name "UX Notes" - :file-uri "https://github.com/penpot/penpot-files/raw/main/UX-Notes.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/UX-Notes.penpot"} {:id "whiteboarding-kit" :name "Whiteboarding Kit" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Whiteboarding-mapping-kit.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Whiteboarding-mapping-kit.penpot"} {:id "open-color-scheme" :name "Open Color Scheme" - :file-uri "https://github.com/penpot/penpot-files/raw/main/Open%20Color%20Scheme%20(v1.9.1).penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/Open%20Color%20Scheme%20(v1.9.1).penpot"} {:id "flex-layout-playground" :name "Flex Layout Playground" - :file-uri "https://github.com/penpot/penpot-files/raw/refs/heads/main/Flex%20Layout%20Playground%20v2.0.penpot"} + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/refs/heads/main/Flex%20Layout%20Playground%20v2.0.penpot"} {:id "welcome" :name "Welcome" - :file-uri "https://github.com/penpot/penpot-files/raw/main/welcome.penpot"}] + :file-uri "https://raw.githubusercontent.com/penpot/penpot-files/main/welcome.penpot"}] diff --git a/backend/src/app/setup/templates.clj b/backend/src/app/setup/templates.clj index 6266dbeb2e..c90120d22f 100644 --- a/backend/src/app/setup/templates.clj +++ b/backend/src/app/setup/templates.clj @@ -57,9 +57,9 @@ (if (fs/exists? path) (io/input-stream path) - (let [resp (http/req cfg - {:method :get :uri (:file-uri template)} - {:response-type :input-stream :sync? true})] + (let [resp (http/req-with-redirects cfg + {:method :get :uri (:file-uri template)} + {:response-type :input-stream :sync? true})] (when-not (= 200 (:status resp)) (ex/raise :type :internal :code :unexpected-status-code