From 02f5d1d5f9b9e4fcd817d5cfb224883683e003bc Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 8 May 2023 18:34:49 +0700 Subject: [PATCH] change path --- src/api/controllers/v1/path.controller.js | 3 +-- src/common/services/adapters/upload-adapter.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/api/controllers/v1/path.controller.js b/src/api/controllers/v1/path.controller.js index f7523b5..b16ef78 100644 --- a/src/api/controllers/v1/path.controller.js +++ b/src/api/controllers/v1/path.controller.js @@ -79,7 +79,6 @@ exports.create = (req, res, next) => { */ exports.update = (req, res, next) => { try { - console.log(cdnConfig.uri, storageConfig.uri); const oldPath = req.body.oldPath.replace(cdnConfig.uri, storageConfig.uri); const newPath = req.body.newPath.replace(cdnConfig.uri, storageConfig.uri); @@ -132,7 +131,7 @@ exports.download = (req, res, next) => { archive.pipe(output); if (req.body.data) { req.body.data.forEach((e) => { - const path = e.path.replace(cdnConfig.uri, storageConfig.uri); + const path = e.path.replace(cdnConfig.uri, storageConfig.uri).replace(/ /g, '%20'); if (e.isFolder) { archive.directory(path, e.name); } else { diff --git a/src/common/services/adapters/upload-adapter.js b/src/common/services/adapters/upload-adapter.js index e294dea..e860f8d 100644 --- a/src/common/services/adapters/upload-adapter.js +++ b/src/common/services/adapters/upload-adapter.js @@ -74,7 +74,7 @@ const storage = multer.diskStorage({ // : file.originalname; cb( null, - `/${path}/${file.originalname}` + `/${path}/${file.originalname.replace(/\s/g, '')}` ); } });