Browse Source

add type of entry for unzip-stream

Ryu Sato 2 years ago
parent
commit
3e3e354ff5
1 changed files with 2 additions and 1 deletions
  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").Entry} Entry
  */
 
 import gc from 'expose-gc/function';
@@ -393,7 +394,7 @@ class ImportService {
     const unzipStreamPipe = readStream.pipe(unzipStream.Parse());
     const files = [];
 
-    unzipStreamPipe.on('entry', (entry) => {
+    unzipStreamPipe.on('entry', (/** @type {Entry} */ entry) => {
       const fileName = entry.path;
       // https://regex101.com/r/mD4eZs/6
       // prevent from unexpecting attack doing unzip file (path traversal attack)