mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-26 01:18:15 +00:00
feature(rest) onPUT: add mellow.convertPath
This commit is contained in:
parent
b16c910995
commit
35f88f1e20
1 changed files with 19 additions and 8 deletions
|
|
@ -286,9 +286,11 @@
|
|||
break;
|
||||
|
||||
case 'mv':
|
||||
if (!Util.checkObjTrue(files, ['from', 'to']) )
|
||||
if (!files.from || !files.to) {
|
||||
sendError(params, p.data);
|
||||
else {
|
||||
} else {
|
||||
files.from = mellow.convertPath(files.from);
|
||||
files.to = mellow.convertPath(files.to);
|
||||
|
||||
if (files.names)
|
||||
data = Util.slice(files.names);
|
||||
|
|
@ -306,9 +308,12 @@
|
|||
break;
|
||||
|
||||
case 'cp':
|
||||
if (!Util.checkObjTrue(files, ['from', 'names', 'to']))
|
||||
if (!files.from || !files.names || !files.to) {
|
||||
sendError(params, p.data);
|
||||
else {
|
||||
} else {
|
||||
files.from = mellow.convertPath(files.from);
|
||||
files.to = mellow.convertPath(files.to);
|
||||
|
||||
files.namesAll = Util.slice(files.names);
|
||||
copyFiles(files, flop.copy, function(error) {
|
||||
if (error)
|
||||
|
|
@ -323,8 +328,11 @@
|
|||
if (!files.from) {
|
||||
sendError(params, p.data);
|
||||
} else {
|
||||
from = files.from;
|
||||
to = files.to || from + '.zip';
|
||||
from = mellow.convertPath(files.from);
|
||||
to = mellow.convertPath(files.to);
|
||||
|
||||
if (!to)
|
||||
to = from + '.zip';
|
||||
|
||||
pack.gzip(from, to, function(error) {
|
||||
var name = path.basename(files.from);
|
||||
|
|
@ -341,8 +349,11 @@
|
|||
if (!files.from) {
|
||||
sendError(params, p.data);
|
||||
} else {
|
||||
from = files.from;
|
||||
to = files.to || Util.rmStrOnce(files.from, ['.zip', '.gzip']);
|
||||
from = mellow.convertPath(files.from);
|
||||
to = mellow.convertPath(files.to);
|
||||
|
||||
if (!to)
|
||||
to = Util.rmStrOnce(files.from, ['.zip', '.gzip']);
|
||||
|
||||
pack.gunzip(from, to, function(error) {
|
||||
var name = path.basename(files.from);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue