From df0addc69b5877b7ed4cf39b9c6891203fcd96a5 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sat, 24 Feb 2024 15:02:36 -0300 Subject: [PATCH] fix(basic.gblib): SEND FILE fix for sub directories. --- .../basic.gblib/services/DialogKeywords.ts | 21 +++++++++++++------ packages/core.gbapp/services/GBMinService.ts | 5 ----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/basic.gblib/services/DialogKeywords.ts b/packages/basic.gblib/services/DialogKeywords.ts index 1ff98c60..dc8daa9f 100644 --- a/packages/basic.gblib/services/DialogKeywords.ts +++ b/packages/basic.gblib/services/DialogKeywords.ts @@ -616,8 +616,12 @@ export class DialogKeywords { if (!people) { throw new Error(`Invalid access. Check if People sheet has the role ${role} checked.`); } + else + { + GBLogEx.info(min, `Allowed access for ${user.userSystemId} on ${role}`); + return people; + } - GBLogEx.info(min, `Allowed access for ${user.userSystemId} on ${role}`); } @@ -1331,15 +1335,20 @@ export class DialogKeywords { else { - GBLog.info(`BASIC: Direct send from .gbdrive: ${filename} to ${mobile}.`); - + const ext = Path.extname(filename); const gbaiName = DialogKeywords.getGBAIPath(min.botId); - + let { baseUrl, client } = await GBDeployer.internalGetDriveClient(min); - let path = '/' + urlJoin(gbaiName, `${min.botId}.gbdrive`); + let url = urlJoin('/', gbaiName, `${min.botId}.gbdrive`, filename); + GBLog.info(`BASIC: Direct send from .gbdrive: ${url} to ${mobile}.`); + const sys = new SystemKeywords(); - let template = await sys.internalGetDocument(client, baseUrl, path, filename); + + const pathOnly = url.substring(0, url.lastIndexOf('/')); + const fileOnly = url.substring(url.lastIndexOf('/') + 1); + + let template = await sys.internalGetDocument(client, baseUrl, pathOnly, fileOnly); const driveUrl = template['@microsoft.graph.downloadUrl']; const res = await fetch(driveUrl); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index cb04bb71..43f0a10f 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -1585,22 +1585,17 @@ export class GBMinService { await close(); - let proxies = {}; await CollectionUtil.asyncForEach(mins, async min => { let dialogs = {}; await CollectionUtil.asyncForEach(Object.values(min.scriptMap), async script => { - - const f = new Function() - dialogs[script] = async (data) => { let params; if (data) { params = JSON.parse(data); } - await GBVMService.callVM(script, min, null, null, null, false, params); } });