0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-18 13:04:38 -05:00

Merge pull request #1919 from penpot/alotor-buf-export

🐛 Fix problem when exporting penpot files
This commit is contained in:
Alejandro 2022-05-18 15:59:21 +02:00 committed by GitHub
commit 1690f1ee23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 12 deletions

View file

@ -584,17 +584,20 @@
(assert (string? basename)) (assert (string? basename))
(assert (set? used)) (assert (set? used))
(let [[prefix initial] (extract-numeric-suffix basename)] (if (> (count basename) 1000)
(if (and (not prefix-first?) ;; We skip generating names for long strings. If the name is too long the regex can hang
(not (contains? used basename))) basename
basename (let [[prefix initial] (extract-numeric-suffix basename)]
(loop [counter initial] (if (and (not prefix-first?)
(let [candidate (if (and (= 1 counter) prefix-first?) (not (contains? used basename)))
(str prefix) basename
(str prefix "-" counter))] (loop [counter initial]
(if (contains? used candidate) (let [candidate (if (and (= 1 counter) prefix-first?)
(recur (inc counter)) (str prefix)
candidate))))))) (str prefix "-" counter))]
(if (contains? used candidate)
(recur (inc counter))
candidate))))))))
(defn deep-mapm (defn deep-mapm
"Applies a map function to an associative map and recurses over its children "Applies a map function to an associative map and recurses over its children

View file

@ -811,7 +811,7 @@
:attrs) :attrs)
image-data (get-svg-data :image node) image-data (get-svg-data :image node)
svg-data (or image-data pattern-data)] svg-data (or image-data pattern-data)]
(:xlink:href svg-data))) (or (:href svg-data) (:xlink:href svg-data))))
(defn get-image-fill (defn get-image-fill
[node] [node]