(core) Treating API urls as external in cells

Summary:
Links for the API endpoints in a cell didn't work as they were interpreted as
internal routes. Now they are properly detected as external.

Test Plan: Added new test

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D4078
This commit is contained in:
Jarosław Sadziński
2023-10-17 18:31:33 +02:00
parent 77726849ad
commit 69d5ee53a8
5 changed files with 50 additions and 8 deletions

View File

@@ -1547,9 +1547,9 @@ export class FlexServer implements GristServer {
state.slug = getSlugIfNeeded(resource);
}
state.org = this._dbManager.normalizeOrgDomain(org.id, org.domain, org.ownerId);
state.api = purpose === 'api';
if (!gristConfig.homeUrl) { throw new Error('Computing a resource URL requires a home URL'); }
return encodeUrl(gristConfig, state, new URL(gristConfig.homeUrl),
{ api: purpose === 'api' });
return encodeUrl(gristConfig, state, new URL(gristConfig.homeUrl));
}
public addUsage() {