diff --git a/src/appmixer/box/bundle.json b/src/appmixer/box/bundle.json index 3750bb860f..13dfc8d428 100644 --- a/src/appmixer/box/bundle.json +++ b/src/appmixer/box/bundle.json @@ -1,8 +1,8 @@ { "name": "appmixer.box", - "version": "1.0.0", + "version": "1.0.1", "changelog": { - "1.0.0": [ + "1.0.1": [ "Initial version" ] } diff --git a/src/appmixer/box/core/CreateFolder/CreateFolder.js b/src/appmixer/box/core/CreateFolder/CreateFolder.js index 8e2c57ace5..51f1590c55 100644 --- a/src/appmixer/box/core/CreateFolder/CreateFolder.js +++ b/src/appmixer/box/core/CreateFolder/CreateFolder.js @@ -10,22 +10,29 @@ module.exports = { throw new context.CancelError('Name is required!'); } - // https://developer.box.com/reference/post-folders/ - const { data } = await context.httpRequest({ - method: 'POST', - url: 'https://api.box.com/2.0/folders', - headers: { - 'Authorization': `Bearer ${context.auth.accessToken}`, - 'Content-Type': 'application/json' - }, - data: { - name, - parent: { - id: parentId + try { + // https://developer.box.com/reference/post-folders/ + const { data } = await context.httpRequest({ + method: 'POST', + url: 'https://api.box.com/2.0/folders', + headers: { + 'Authorization': `Bearer ${context.auth.accessToken}`, + 'Content-Type': 'application/json' + }, + data: { + name, + parent: { + id: parentId + } } - } - }); + }); - return context.sendJson(data, 'out'); + return context.sendJson(data, 'out'); + } catch (error) { + if (error.status === 409) { + throw new context.CancelError('Folder already exists'); + } + throw error; + } } }; diff --git a/src/appmixer/box/core/FindFilesOrFolders/component.json b/src/appmixer/box/core/FindFilesOrFolders/component.json index f7a52ac15f..27030f2cf2 100644 --- a/src/appmixer/box/core/FindFilesOrFolders/component.json +++ b/src/appmixer/box/core/FindFilesOrFolders/component.json @@ -40,8 +40,7 @@ "default": "array" }, "exactMatch": { - "type": "boolean", - "default": false + "type": "boolean" } }, "required": [