From 681112f513679a723bdff0e3dd91c409c4de95e2 Mon Sep 17 00:00:00 2001 From: purocean Date: Tue, 27 Mar 2018 19:21:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/file.js | 4 ++++ backend/main.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/file.js b/backend/file.js index d3ca61fe..e69c53f1 100644 --- a/backend/file.js +++ b/backend/file.js @@ -8,6 +8,10 @@ const mkdirPSync = location => { let folders = parsedPathObj.dir.split(path.sep) folders.push(parsedPathObj.base) for(let part of folders) { + if (part.indexOf(':') > -1) { // 修复 Windows 下面路径错误 + continue + } + curDir = path.join(curDir, part) if (!fs.existsSync(curDir)) { fs.mkdirSync(curDir) diff --git a/backend/main.js b/backend/main.js index 58f96401..41db16ee 100644 --- a/backend/main.js +++ b/backend/main.js @@ -56,4 +56,7 @@ app.use(bodyParser({multipart: true})) app.use(async (ctx, next) => fileContent(ctx, next)) app.use(async (ctx, next) => attachment(ctx, next)) -app.listen(3000) +const port = 3000 +app.listen(port) + +console.log(`访问地址:http://localhost:${port}`)