From d46f7edce8692bd014f55b9906386757c12798b8 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 9 Jan 2024 00:52:56 +0000 Subject: [PATCH] fix: better error for private at bases --- .../modules/jobs/jobs/at-import/helpers/fetchAT.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts index 6eb677fcec..471dd9eae8 100644 --- a/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts +++ b/packages/nocodb/src/modules/jobs/jobs/at-import/helpers/fetchAT.ts @@ -50,12 +50,24 @@ async function initialize(shareId, appId?: string) { }; }); + const headers = hreq.match(/(?<=var headers =)(.*)(?=;)/g); + const link = hreq.match(/(?<=fetch\(")(\\.*)(?=")/g); + + if (!headers || !link) { + throw { + message: + 'Please ensure www.airtable.com/ is available for public access. Refer https://bit.ly/3x0OdXI for details', + }; + } + info.headers = JSON.parse( hreq.match(/(?<=var headers =)(.*)(?=;)/g)[0].trim(), ); + info.link = unicodeToChar( hreq.match(/(?<=fetch\(")(\\.*)(?=")/g)[0].trim(), ); + info.baseInfo = decodeURIComponent(info.link) .match(/{(.*)}/g)[0] .split('&')