mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(rest) add getCMD
This commit is contained in:
parent
04681237c0
commit
4a97a0f999
1 changed files with 8 additions and 5 deletions
|
|
@ -152,9 +152,14 @@ function streamPack(cmd, response) {
|
|||
operation('pack', dir, response, names, noop);
|
||||
}
|
||||
|
||||
function onPUT(name, body, callback) {
|
||||
let cmd;
|
||||
function getCMD(cmd) {
|
||||
if (cmd[0] === '/')
|
||||
return cmd.slice(1);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
function onPUT(name, body, callback) {
|
||||
check
|
||||
.type('callback', callback, 'function')
|
||||
.check({
|
||||
|
|
@ -162,9 +167,7 @@ function onPUT(name, body, callback) {
|
|||
body,
|
||||
});
|
||||
|
||||
if (name[0] === '/')
|
||||
cmd = name.replace('/', '');
|
||||
|
||||
const cmd = getCMD(name);
|
||||
const files = json.parse(body);
|
||||
|
||||
switch(cmd) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue