fix(basic.gblib): SEND FILE fix for sub directories.

This commit is contained in:
Rodrigo Rodriguez 2024-02-24 15:02:36 -03:00
parent 36e950ca52
commit df0addc69b
2 changed files with 15 additions and 11 deletions

View file

@ -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);

View file

@ -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);
}
});