From 3ea3ac29d0c9aee765cacd68027ecf0a17187567 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Thu, 12 Sep 2024 02:21:02 +0200 Subject: [PATCH] workaround for new webr format --- routes/cdn.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routes/cdn.js b/routes/cdn.js index ad30567..96713e6 100644 --- a/routes/cdn.js +++ b/routes/cdn.js @@ -39,7 +39,15 @@ function tar_index_files(input){ var extract = tar.extract({allowUnknownFormat: true}) .on('entry', process_entry) .on('finish', finish_stream) - .on('error', reject); + .on('error', function(err){ + if (err.message.includes('Unexpected end') && files.length > 0){ + finish_stream(); //workaround tar-stream bug for custom webr 0.4.2 tar headers + } else { + reject(err); + } + }); + + input.pipe(gunzip()).pipe(extract); }); }