Jelajahi Sumber

add type of entry for unzip-stream

Ryu Sato 2 tahun lalu
induk
melakukan
3e3e354ff5
1 mengubah file dengan 2 tambahan dan 1 penghapusan
  1. 2 1
      apps/app/src/server/service/import.js

+ 2 - 1
apps/app/src/server/service/import.js

@@ -1,5 +1,6 @@
 /**
 /**
  * @typedef {import("@types/unzip-stream").Parse} Parse
  * @typedef {import("@types/unzip-stream").Parse} Parse
+ * @typedef {import("@types/unzip-stream").Entry} Entry
  */
  */
 
 
 import gc from 'expose-gc/function';
 import gc from 'expose-gc/function';
@@ -393,7 +394,7 @@ class ImportService {
     const unzipStreamPipe = readStream.pipe(unzipStream.Parse());
     const unzipStreamPipe = readStream.pipe(unzipStream.Parse());
     const files = [];
     const files = [];
 
 
-    unzipStreamPipe.on('entry', (entry) => {
+    unzipStreamPipe.on('entry', (/** @type {Entry} */ entry) => {
       const fileName = entry.path;
       const fileName = entry.path;
       // https://regex101.com/r/mD4eZs/6
       // https://regex101.com/r/mD4eZs/6
       // prevent from unexpecting attack doing unzip file (path traversal attack)
       // prevent from unexpecting attack doing unzip file (path traversal attack)