0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-12 15:01:28 -05:00

🐛 Fix import format detection and error handling

This commit is contained in:
Andrey Antukh 2024-11-25 12:29:59 +01:00
parent ef3588d05f
commit 577b731b22
2 changed files with 14 additions and 3 deletions

View file

@ -64,6 +64,7 @@
}
.file-entry {
display: flex;
.file-name {
@include flexRow;
.file-icon {
@ -114,6 +115,8 @@
}
.error-message,
.progress-message {
display: flex;
align-items: center;
height: $s-32;
color: var(--modal-text-foreground-color);
}

View file

@ -799,7 +799,8 @@
(rx/merge-map
(fn [body]
(let [mtype (parse-mtype body)]
(if (= "application/zip" mtype)
(cond
(= "application/zip" mtype)
(->> (uz/load body)
(rx/merge-map read-zip-manifest)
(rx/map
@ -808,7 +809,13 @@
(let [manifest (decode-manifest manifest)]
(assoc file :type :binfile-v3 :files (:files manifest)))
(assoc file :type :legacy-zip :body body)))))
(rx/of (assoc file :type :binfile-v1))))))
(= "application/octet-stream" mtype)
(rx/of (assoc file :type :binfile-v1))
:else
(rx/of (assoc file :type :unknown))))))
(rx/share))]
(->> (rx/merge
@ -837,9 +844,10 @@
(assoc :status :success))))))))
(->> stream
(rx/filter (fn [data] (= "other" (:type data))))
(rx/filter (fn [data] (= :unknown (:type data))))
(rx/map (fn [_]
{:uri (:uri file)
:status :error
:error (tr "dashboard.import.analyze-error")}))))
(rx/catch (fn [cause]