From faa19bf69e3c2cf995513240d0ef64b25da73d99 Mon Sep 17 00:00:00 2001 From: ganghee Date: Sun, 5 Sep 2021 19:47:18 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/userControllers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/userControllers.js b/controllers/userControllers.js index 6641a62..7c2e02f 100644 --- a/controllers/userControllers.js +++ b/controllers/userControllers.js @@ -185,13 +185,14 @@ const changeUserImage = async(req, res) => { logger.info(`Changing user's image of [${req.session.userId}] ...`); let returnResult = {}; const profileImg = req.file.path.split(`${process.env.IMG_FILE_PATH}/`)[1]; - const [updatedCnt] = await UserSchema.updateUserImg(req.session.userId, profileImg); + const imagePath = profileImg.split('/')[1] + "/" + profileImg.split('/')[2] + const [updatedCnt] = await UserSchema.updateUserImg(req.session.userId, imagePath); if(!updatedCnt){ throw new InternalServerError } returnResult.rc = 200; returnResult.rcmsg = resString.SUCCESS; - returnResult.profileImg = process.env.IMG_FILE_PATH + '/' + profileImg; + returnResult.profileImg = profileFilePath + imagePath; res.send(returnResult); }