Skip to content

Commit c307651

Browse files
author
Aamod Pisat
committed
fix the bug: One liner code (curl) is working incorrect for Publish/Unpublish command
1 parent 4adf36a commit c307651

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

lib/connect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ var Connect = function (args) {
217217

218218
// initalise the headers
219219
this.headers = {
220-
"User-Agent": 'contentstack-cli/' + pkg.version
220+
"X-User-Agent": 'contentstack-cli/' + pkg.version
221221
};
222222

223223
// merging the args to input

lib/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ var pluginTemplate = function (_name, pluginName) {
143143
' /*',
144144
' * @beforePublish',
145145
' * @Description: This function is triggered when the publish event occurs.',
146-
' * @Parameters: data - contains un-published entry, it\'s content_type and language.',
146+
' * @Parameters: data - contains published entry, it\'s content_type and language.',
147147
' * @Parameters: next - call this function to pass control to the next subsequent "beforePublish" hook.',
148148
' * It is important to call the next() function, it will affect the publish process,',
149149
' * the entry will get stuck to "in-prgoress" state.',

lib/publish.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var inputs = {},
2828
api = config.get('contentstack'),
2929
headers = {
3030
api_key: api.api_key,
31-
"User-Agent": 'contentstack-cli/' + pkg.version
31+
"X-User-Agent": 'contentstack-cli/' + pkg.version
3232
},
3333
bound = 100,
3434
backup;
@@ -134,6 +134,7 @@ var publish = function (_event, options) {
134134
delete schema.skip_content_types;
135135
delete options.content_types;
136136
delete options.skip_content_types;
137+
inputs[key] = options[key];
137138
} else if (typeof options[key] === "undefined") {
138139
_params.push(schema[key]);
139140
} else {

lib/sync.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ module.exports = Sync;
8484

8585
backup = utility.matchConfirm(cmdInputs['backup']);
8686
delete cmdInputs['backup'];
87-
87+
if(cmdInputs['type'] === 'assets') {
88+
delete self._options['content_types'];
89+
delete self._options['skip_content_types'];
90+
delete cmdInputs['content_types'];
91+
delete cmdInputs['skip_content_types'];
92+
}
8893
async.series([
8994
function (cb) {
9095
utility
@@ -109,7 +114,7 @@ module.exports = Sync;
109114
for (var key in cmdInputs) {
110115
if (key && typeof self._options[key] === 'undefined') {
111116
switch (key) {
112-
case 'type':
117+
case 'type':
113118
fn = utility.inputCustom(utility.inputs.type());
114119
break;
115120
case 'environment':

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
this.headers = {
3434
api_key: api.api_key,
3535
access_token: api.access_token,
36-
"User-Agent": 'contentstack-cli/' + pkg.version
36+
"X-User-Agent": 'contentstack-cli/' + pkg.version
3737
};
3838
}
3939
}

0 commit comments

Comments
 (0)