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);