mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 18:18:24 -05:00
Merge pull request #5368 from penpot/niwinz-bugfix-3
🐛 Fix import format detection and error handling
This commit is contained in:
commit
8448036d67
4 changed files with 28 additions and 9 deletions
|
@ -508,6 +508,7 @@ export async function compileStyles() {
|
||||||
const start = process.hrtime();
|
const start = process.hrtime();
|
||||||
|
|
||||||
log.info("init: compile styles");
|
log.info("init: compile styles");
|
||||||
|
|
||||||
let result = await compileSassAll(worker);
|
let result = await compileSassAll(worker);
|
||||||
result = concatSass(result);
|
result = concatSass(result);
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,22 @@ async function compileSassAll() {
|
||||||
async function compileSass(path) {
|
async function compileSass(path) {
|
||||||
const start = process.hrtime();
|
const start = process.hrtime();
|
||||||
log.info("changed:", path);
|
log.info("changed:", path);
|
||||||
const result = await h.compileSass(worker, path, { modules: true });
|
|
||||||
sass.index[result.outputPath] = result.css;
|
|
||||||
|
|
||||||
const output = h.concatSass(sass);
|
try {
|
||||||
|
const result = await h.compileSass(worker, path, { modules: true });
|
||||||
|
sass.index[result.outputPath] = result.css;
|
||||||
|
|
||||||
await fs.writeFile("./resources/public/css/main.css", output);
|
const output = h.concatSass(sass);
|
||||||
|
|
||||||
const end = process.hrtime(start);
|
await fs.writeFile("./resources/public/css/main.css", output);
|
||||||
log.info("done:", `(${ppt(end)})`);
|
|
||||||
|
const end = process.hrtime(start);
|
||||||
|
log.info("done:", `(${ppt(end)})`);
|
||||||
|
} catch (cause) {
|
||||||
|
console.error(cause);
|
||||||
|
const end = process.hrtime(start);
|
||||||
|
log.error("error:", `(${ppt(end)})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await fs.mkdir("./resources/public/css/", { recursive: true });
|
await fs.mkdir("./resources/public/css/", { recursive: true });
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-entry {
|
.file-entry {
|
||||||
|
display: flex;
|
||||||
.file-name {
|
.file-name {
|
||||||
@include flexRow;
|
@include flexRow;
|
||||||
.file-icon {
|
.file-icon {
|
||||||
|
@ -114,6 +115,8 @@
|
||||||
}
|
}
|
||||||
.error-message,
|
.error-message,
|
||||||
.progress-message {
|
.progress-message {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
height: $s-32;
|
height: $s-32;
|
||||||
color: var(--modal-text-foreground-color);
|
color: var(--modal-text-foreground-color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -799,7 +799,8 @@
|
||||||
(rx/merge-map
|
(rx/merge-map
|
||||||
(fn [body]
|
(fn [body]
|
||||||
(let [mtype (parse-mtype body)]
|
(let [mtype (parse-mtype body)]
|
||||||
(if (= "application/zip" mtype)
|
(cond
|
||||||
|
(= "application/zip" mtype)
|
||||||
(->> (uz/load body)
|
(->> (uz/load body)
|
||||||
(rx/merge-map read-zip-manifest)
|
(rx/merge-map read-zip-manifest)
|
||||||
(rx/map
|
(rx/map
|
||||||
|
@ -808,7 +809,13 @@
|
||||||
(let [manifest (decode-manifest manifest)]
|
(let [manifest (decode-manifest manifest)]
|
||||||
(assoc file :type :binfile-v3 :files (:files manifest)))
|
(assoc file :type :binfile-v3 :files (:files manifest)))
|
||||||
(assoc file :type :legacy-zip :body body)))))
|
(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/share))]
|
||||||
|
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
|
@ -837,9 +844,10 @@
|
||||||
(assoc :status :success))))))))
|
(assoc :status :success))))))))
|
||||||
|
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter (fn [data] (= "other" (:type data))))
|
(rx/filter (fn [data] (= :unknown (:type data))))
|
||||||
(rx/map (fn [_]
|
(rx/map (fn [_]
|
||||||
{:uri (:uri file)
|
{:uri (:uri file)
|
||||||
|
:status :error
|
||||||
:error (tr "dashboard.import.analyze-error")}))))
|
:error (tr "dashboard.import.analyze-error")}))))
|
||||||
|
|
||||||
(rx/catch (fn [cause]
|
(rx/catch (fn [cause]
|
||||||
|
|
Loading…
Add table
Reference in a new issue