mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
🐛 Fix duplicated suffix on single-file WASM exports (#13125)
This commit is contained in:
parent
0915f89419
commit
14b9d77e9f
@ -128,6 +128,14 @@
|
||||
:name name
|
||||
:suffix suffix})
|
||||
|
||||
(defn local-export-filename
|
||||
"A single export's `:name` already carries the suffix (added by the UI)."
|
||||
[kind entry export-name]
|
||||
(case kind
|
||||
:pdf-frames (str (or export-name "export") ".pdf")
|
||||
:single (wasm.exports/sanitize-filename (dissoc entry :suffix) #{})
|
||||
(str (or export-name "export") ".zip")))
|
||||
|
||||
(defn- run-local-export
|
||||
[{:keys [job-id kind exports objects background] export-name :name}]
|
||||
(let [exports (mapv export-entry exports)]
|
||||
@ -162,14 +170,7 @@
|
||||
|
||||
:else
|
||||
(let [entry (first exports)
|
||||
filename (case kind
|
||||
:pdf-frames
|
||||
(str (or export-name "export") ".pdf")
|
||||
|
||||
:single
|
||||
(wasm.exports/sanitize-filename entry #{})
|
||||
|
||||
(str (or export-name "export") ".zip"))
|
||||
filename (local-export-filename kind entry export-name)
|
||||
mtype (case kind
|
||||
:pdf-frames "application/pdf"
|
||||
:single (export-mtype (:type entry))
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
(ns frontend-tests.worker.exports-test
|
||||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.worker.exports :as wexports]
|
||||
[app.worker.wasm :as wwasm]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.test :as t :include-macros true]
|
||||
@ -48,6 +49,14 @@
|
||||
@order)
|
||||
"job B starts only after job A has finished")))
|
||||
|
||||
(t/deftest single-export-filename-does-not-repeat-suffix
|
||||
(t/is (= "Ellipseabc.svg"
|
||||
(wexports/local-export-filename
|
||||
:single {:name "Ellipseabc" :suffix "abc" :type :svg} nil)))
|
||||
(t/is (= "Ellipse.png"
|
||||
(wexports/local-export-filename
|
||||
:single {:name "Ellipse" :suffix nil :type :png} nil))))
|
||||
|
||||
(t/deftest cancel-job-is-visible-to-cancelled
|
||||
(let [job-id (uuid/next)]
|
||||
(t/is (false? (wwasm/cancelled? job-id)))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user