From 3488edad7bcba725a28f97ba081094ea0e424711 Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Mon, 4 Oct 2021 12:10:39 +0200 Subject: [PATCH 1/2] :zap: Fix whitespace editorconfig highlights for seaTable node --- packages/nodes-base/nodes/SeaTable/Interfaces.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/SeaTable/Interfaces.ts b/packages/nodes-base/nodes/SeaTable/Interfaces.ts index 8d8357476b..4d8269edb2 100644 --- a/packages/nodes-base/nodes/SeaTable/Interfaces.ts +++ b/packages/nodes-base/nodes/SeaTable/Interfaces.ts @@ -93,9 +93,9 @@ export interface ICtx { export interface IRowResponse{ metadata: [ - { + { key: string, - name: string + name: string } ]; results: IRow[]; From a04ec2102ccfda500a3952bf5fe5e259843a8044 Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Mon, 4 Oct 2021 13:49:16 +0200 Subject: [PATCH 2/2] :zap: Fix common user-error Given a domain (the base-URI) in credentials terminated by a slash "/" is a common user-error when entering such data. Pass through userBaseUri() to trim slashes from the end of the string. --- .../nodes-base/nodes/SeaTable/GenericFunctions.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/nodes-base/nodes/SeaTable/GenericFunctions.ts b/packages/nodes-base/nodes/SeaTable/GenericFunctions.ts index 267e9390f1..4f39075bbd 100644 --- a/packages/nodes-base/nodes/SeaTable/GenericFunctions.ts +++ b/packages/nodes-base/nodes/SeaTable/GenericFunctions.ts @@ -129,7 +129,7 @@ export async function getBaseAccessToken(this: IExecuteFunctions | ILoadOptionsF export function resolveBaseUri(ctx: ICtx) { return (ctx?.credentials?.environment === 'cloudHosted') - ? 'https://cloud.seatable.io' : ctx?.credentials?.domain; + ? 'https://cloud.seatable.io' : userBaseUri(ctx?.credentials?.domain); } export function simplify(data: { results: IRow[] }, metadata: IDataObject) { @@ -292,3 +292,12 @@ export const split = (subject: string): string[] => .filter(s => s.length) .map(s => s.replace(/\\([\s\S])/gm, ($0, $1) => $1)) ; + +const userBaseUri = (str?: string) => { + if (str === undefined) { + return str; + } + let end = str.length; + for (; end > 0 && str[end - 1] === '/'; --end) {} + return end < str.length ? str.substring(0, end) : str; +};