Просмотр исходного кода

Fix zipped files not being compressed

When zipping files using the JSZip library, by default, files are not
compressed when they are zipped (`store` compression level is used). The
JSZip options have now been updated to actually compress the files.

The affected processes are the logs and endpoints downloads.
Sergiu Miclea 3 лет назад
Родитель
Сommit
fda0cbe440
2 измененных файлов с 12 добавлено и 3 удалено
  1. 4 1
      src/stores/EndpointStore.ts
  2. 8 2
      src/stores/LogStore.ts

+ 4 - 1
src/stores/EndpointStore.ts

@@ -223,7 +223,10 @@ class EndpointStore {
       })
     );
 
-    const content = await zip.generateAsync({ type: "blob" });
+    const content = await zip.generateAsync({
+      type: "blob",
+      compression: "DEFLATE",
+    });
     saveAs(content, "coriolis-endpoints.zip");
   }
 

+ 8 - 2
src/stores/LogStore.ts

@@ -104,7 +104,10 @@ class LogStore {
       zip.file(`${response.name}.log`, response.content.data);
     });
     await downloadDiagnosticsIntoZip(zip);
-    const zipContent = await zip.generateAsync({ type: "blob" });
+    const zipContent = await zip.generateAsync({
+      type: "blob",
+      compression: "DEFLATE",
+    });
     saveAs(zipContent, "logs.zip");
     runInAction(() => {
       this.downloadingAllLogs = false;
@@ -125,7 +128,10 @@ class LogStore {
     this.generatingDiagnostics = true;
     const zip = new JSZip();
     await downloadDiagnosticsIntoZip(zip);
-    const zipContent = await zip.generateAsync({ type: "blob" });
+    const zipContent = await zip.generateAsync({
+      type: "blob",
+      compression: "DEFLATE",
+    });
     saveAs(zipContent, "diagnostics.zip");
     runInAction(() => {
       this.generatingDiagnostics = false;