Browse Source

Добавлено восстановление файлов из webdav

Book Pauk 3 years ago
parent
commit
edc3b669be
1 changed files with 5 additions and 11 deletions
  1. 5 11
      server/routes.js

+ 5 - 11
server/routes.js

@@ -107,17 +107,11 @@ function initStatic(app, config) {
 
 
         //восстановим
         //восстановим
         if (!await fs.pathExists(filePath)) {
         if (!await fs.pathExists(filePath)) {
-            /*const zlib = require('zlib');
-            const gzipBuffer = async(buf) => {
-                return new Promise((resolve, reject) => {
-                    zlib.gzip(buf, {level: 1}, (err, result) => {
-                        if (err) reject(err);
-                        resolve(result);
-                    });
-                });
-            };
-
-            await fs.writeFile(filePath, await gzipBuffer(`<filepath>${filePath}</filepath>`));*/
+            if (req.path.indexOf('/tmp/') === 0) {
+                await readerWorker.restoreRemoteFile(req.path, '/tmp');
+            } else if (req.path.indexOf('/upload/') === 0) {
+                await readerWorker.restoreRemoteFile(req.path, '/upload');
+            }
         }
         }
 
 
         return next();
         return next();