🔀 Merge branch 'seatable-node' of https://github.com/seatable/n8n into seatable-seatable-node

This commit is contained in:
Jan Oberhauser 2021-10-07 16:57:48 -05:00
commit 29887c11c1
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -93,9 +93,9 @@ export interface ICtx {
export interface IRowResponse{
metadata: [
{
{
key: string,
name: string
name: string
}
];
results: IRow[];