feature(rest) onPUT: add WIN32_ROOT_MSG

This commit is contained in:
coderaiser 2014-07-02 06:25:56 -04:00
parent b1387bc941
commit f79001b972

View file

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