From 219b1f3f8757d7f16b25901a461c85c677caf3f1 Mon Sep 17 00:00:00 2001 From: George Gevoian Date: Thu, 22 Feb 2024 12:01:17 -0500 Subject: [PATCH] (core) Add org to FormAPI URL paths Summary: In some environments, URLs produced by FormAPI were missing an org, making them ambiguous. This ensures that an org is always included in the path. Test Plan: Manual. Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4200 --- app/client/ui/FormAPI.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/client/ui/FormAPI.ts b/app/client/ui/FormAPI.ts index 1e2d65ae..415d3fc0 100644 --- a/app/client/ui/FormAPI.ts +++ b/app/client/ui/FormAPI.ts @@ -1,5 +1,6 @@ import {BaseAPI, IOptions} from 'app/common/BaseAPI'; import {CellValue, ColValues} from 'app/common/DocActions'; +import {addCurrentOrgToPath} from 'app/common/urlUtils'; /** * Form and associated field metadata from a Grist view section. @@ -82,11 +83,8 @@ interface CreateRecordWithShareKeyOptions extends CreateRecordCommonOptions { type CreateRecordOptions = CreateRecordWithDocIdOptions | CreateRecordWithShareKeyOptions; export class FormAPIImpl extends BaseAPI implements FormAPI { - private _url: string; - - constructor(url: string, options: IOptions = {}) { + constructor(private _homeUrl: string, options: IOptions = {}) { super(options); - this._url = url.replace(/\/$/, ''); } public async getForm(options: GetFormOptions): Promise
{ @@ -114,4 +112,8 @@ export class FormAPIImpl extends BaseAPI implements FormAPI { }); } } + + private get _url(): string { + return addCurrentOrgToPath(this._homeUrl); + } }