mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(rest) add isRootWin32 check on: copy, move
This commit is contained in:
parent
09c528ae99
commit
b1387bc941
1 changed files with 10 additions and 2 deletions
|
|
@ -40,6 +40,8 @@
|
|||
pack = require(DIR + 'pack'),
|
||||
mellow = require(DIR + 'mellow'),
|
||||
format = require(DIR + 'format'),
|
||||
isWin32 = process.platform === 'win32',
|
||||
|
||||
|
||||
NOT_LOG = true;
|
||||
|
||||
|
|
@ -287,7 +289,7 @@
|
|||
break;
|
||||
|
||||
case 'mv':
|
||||
if (!files.from || !files.to) {
|
||||
if (!files.from || !files.to || isRootWin32(files.to)) {
|
||||
sendError(params, p.data);
|
||||
} else {
|
||||
files.from = mellow.convertPath(files.from);
|
||||
|
|
@ -309,7 +311,7 @@
|
|||
break;
|
||||
|
||||
case 'cp':
|
||||
if (!files.from || !files.names || !files.to) {
|
||||
if (!files.from || !files.names || !files.to || isRootWin32(files.to)) {
|
||||
sendError(params, p.data);
|
||||
} else {
|
||||
files.from = mellow.convertPath(files.from);
|
||||
|
|
@ -436,6 +438,12 @@
|
|||
copy();
|
||||
}
|
||||
|
||||
function isRootWin32(path) {
|
||||
var isRoot = path === '/';
|
||||
|
||||
return isWin32 && isRoot;
|
||||
}
|
||||
|
||||
function sendMsg(sendParam, msgParam, dataParam, status) {
|
||||
var msg, data,
|
||||
isObj = Util.isObject(dataParam);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue