From f79001b9728b9662f16801abe5ff2fe7d42ac4d1 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 2 Jul 2014 06:25:56 -0400 Subject: [PATCH] feature(rest) onPUT: add WIN32_ROOT_MSG --- lib/server/rest.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/server/rest.js b/lib/server/rest.js index 596cd0fe..17814db5 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -268,7 +268,9 @@ */ function onPUT(params) { var p, cmd, files, name, json, config, data, from, to, - ret = main.checkParams(params, ['body']); + + WIN32_ROOT_MSG = 'Could not copy to root on windows!', + ret = main.checkParams(params, ['body']); if (ret) { p = params, @@ -289,8 +291,10 @@ break; case 'mv': - if (!files.from || !files.to || isRootWin32(files.to)) { + if (!files.from || !files.to) { sendError(params, p.data); + } else if (isRootWin32(files.to)) { + sendError(params, WIN32_ROOT_MSG); } else { files.from = mellow.convertPath(files.from); files.to = mellow.convertPath(files.to); @@ -311,8 +315,10 @@ break; case 'cp': - if (!files.from || !files.names || !files.to || isRootWin32(files.to)) { + if (!files.from || !files.names || !files.to) { sendError(params, p.data); + } else if (isRootWin32(files.to)) { + sendError(params, WIN32_ROOT_MSG); } else { files.from = mellow.convertPath(files.from); files.to = mellow.convertPath(files.to);