Skip to content

Commit

Permalink
keep v1 handler for single file action
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 committed May 7, 2024
1 parent 5ba10af commit 611faf5
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/filesplugin28.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,25 @@ function registerFileAction28(fileAction, inlineSvgIcon) {
},
async exec(node, view, dir) {
const exAppFileActionHandler = generateAppAPIProxyUrl(fileAction.appid, fileAction.action_handler)
return axios.post(exAppFileActionHandler, { files: [buildNodeInfo(node)] })
.then((response) => {
if ('redirect_handler' in response.data) {
const redirectPage = generateExAppUIPageUrl(fileAction.appid, response.data.redirect_handler)
window.location.assign(`${redirectPage}?fileIds=${node.fileid}`)
if ('version' in fileAction && fileAction.version === '2.0') {
return axios.post(exAppFileActionHandler, { files: [buildNodeInfo(node)] })
.then((response) => {
if ('redirect_handler' in response.data) {
const redirectPage = generateExAppUIPageUrl(fileAction.appid, response.data.redirect_handler)
window.location.assign(`${redirectPage}?fileIds=${node.fileid}`)
return true
}
return true
}
}).catch((error) => {
console.error('Failed to send FileAction request to ExApp', error)
return false
})
}
return axios.post(exAppFileActionHandler, buildNodeInfo(node))
.then((response) => {
return true
}).catch((error) => {
})
.catch((error) => {
console.error('Failed to send FileAction request to ExApp', error)
return false
})
Expand Down

0 comments on commit 611faf5

Please sign in to comment.