Skip to content

Commit 23c53cd

Browse files
authored
Box: fixes after testing (#945)
1 parent bb4b305 commit 23c53cd

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

src/appmixer/box/bundle.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "appmixer.box",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"changelog": {
5-
"1.0.0": [
5+
"1.0.1": [
66
"Initial version"
77
]
88
}

src/appmixer/box/core/CreateFolder/CreateFolder.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,29 @@ module.exports = {
1010
throw new context.CancelError('Name is required!');
1111
}
1212

13-
// https://developer.box.com/reference/post-folders/
14-
const { data } = await context.httpRequest({
15-
method: 'POST',
16-
url: 'https://api.box.com/2.0/folders',
17-
headers: {
18-
'Authorization': `Bearer ${context.auth.accessToken}`,
19-
'Content-Type': 'application/json'
20-
},
21-
data: {
22-
name,
23-
parent: {
24-
id: parentId
13+
try {
14+
// https://developer.box.com/reference/post-folders/
15+
const { data } = await context.httpRequest({
16+
method: 'POST',
17+
url: 'https://api.box.com/2.0/folders',
18+
headers: {
19+
'Authorization': `Bearer ${context.auth.accessToken}`,
20+
'Content-Type': 'application/json'
21+
},
22+
data: {
23+
name,
24+
parent: {
25+
id: parentId
26+
}
2527
}
26-
}
27-
});
28+
});
2829

29-
return context.sendJson(data, 'out');
30+
return context.sendJson(data, 'out');
31+
} catch (error) {
32+
if (error.status === 409) {
33+
throw new context.CancelError('Folder already exists');
34+
}
35+
throw error;
36+
}
3037
}
3138
};

src/appmixer/box/core/FindFilesOrFolders/component.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"default": "array"
4141
},
4242
"exactMatch": {
43-
"type": "boolean",
44-
"default": false
43+
"type": "boolean"
4544
}
4645
},
4746
"required": [

0 commit comments

Comments
 (0)