فهرست منبع

Merge branch 'release/0.12.2-2'

Book Pauk 2 سال پیش
والد
کامیت
f926732070
4فایلهای تغییر یافته به همراه24 افزوده شده و 13 حذف شده
  1. 1 0
      build/webpack.base.config.js
  2. 3 2
      build/webpack.dev.config.js
  3. 3 2
      build/webpack.prod.config.js
  4. 17 9
      server/core/Reader/ReaderWorker.js

+ 1 - 0
build/webpack.base.config.js

@@ -14,6 +14,7 @@ module.exports = {
     entry: [`${clientDir}/main.js`],
     output: {
         publicPath: '/app/',
+        clean: true
     },
 
     module: {

+ 3 - 2
build/webpack.dev.config.js

@@ -16,7 +16,8 @@ module.exports = merge(baseWpConfig, {
     devtool: 'inline-source-map',
     output: {
         path: `${publicDir}/app`,
-        filename: 'bundle.js'
+        filename: 'bundle.js',
+        clean: true
     },
 
     module: {
@@ -38,6 +39,6 @@ module.exports = merge(baseWpConfig, {
             template: `${clientDir}/index.html.template`,
             filename: `${publicDir}/index.html`
         }),
-        new CopyWebpackPlugin({patterns: [{from: `${clientDir}/assets/*`, to: `${publicDir}/`}]})
+        new CopyWebpackPlugin({patterns: [{context: `${clientDir}/assets`, from: `${clientDir}/assets/*`, to: `${publicDir}/`}]})
     ]
 });

+ 3 - 2
build/webpack.prod.config.js

@@ -18,7 +18,8 @@ module.exports = merge(baseWpConfig, {
     mode: 'production',
     output: {
         path: `${publicDir}/app_new`,
-        filename: 'bundle.[contenthash].js'
+        filename: 'bundle.[contenthash].js',
+        clean: true        
     },
     module: {
         rules: [
@@ -54,7 +55,7 @@ module.exports = merge(baseWpConfig, {
             filename: `${publicDir}/index.html`
         }),
         new CopyWebpackPlugin({patterns: 
-            [{from: `${clientDir}/assets/*`, to: `${publicDir}/`, context: `${clientDir}/assets` }]
+            [{context: `${clientDir}/assets`, from: `${clientDir}/assets/*`, to: `${publicDir}/` }]
         }),
         new GenerateSW({
             cacheId: 'liberama',

+ 17 - 9
server/core/Reader/ReaderWorker.js

@@ -83,6 +83,7 @@ class ReaderWorker {
         let convertFilename = '';
 
         const overLoadMes = 'Слишком большая очередь загрузки. Пожалуйста, попробуйте позже.';
+        const fileNotFoundMes = 'Файл не найден';
         const overLoadErr = new Error(overLoadMes);
 
         let q = null;
@@ -184,26 +185,33 @@ class ReaderWorker {
             })();
 
         } catch (e) {
+            log(LM_ERR, `url: ${url}, downloadedFilename: ${downloadedFilename}`);
             log(LM_ERR, e.stack);
             let mes = e.message.split('|FORLOG|');
             if (mes[1])
                 log(LM_ERR, mes[0] + mes[1]);
-            log(LM_ERR, `downloadedFilename: ${downloadedFilename}`);
 
             mes = mes[0];
             if (mes == 'abort')
                 mes = overLoadMes;
+            if (mes.indexOf('ENOTDIR') >= 0)
+                mes = fileNotFoundMes;
+
             wState.set({state: 'error', error: mes});
         } finally {
             //clean
-            if (q)
-                q.ret();
-            if (decompDir)
-                await fs.remove(decompDir);
-            if (downloadedFilename && !isUploaded)
-                await fs.remove(downloadedFilename);
-            if (convertFilename)
-                await fs.remove(convertFilename);
+            try {
+                if (q)
+                    q.ret();
+                if (decompDir)
+                    await fs.remove(decompDir);
+                if (downloadedFilename && !isUploaded)
+                    await fs.remove(downloadedFilename);
+                if (convertFilename)
+                    await fs.remove(convertFilename);
+            } catch (e) {
+                log(LM_ERR, `Remove error: ${e.stack}`);
+            }
         }
     }