(core) Fix WelcomePage to use an explicit action URL, and parse submitted body in time to log it with errors.

Test Plan: Tested manually that "Preflight" error goes away in Safari.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2644
This commit is contained in:
Dmitry S
2020-10-19 11:11:03 -04:00
parent 0b1aa22ad9
commit ad7be0fd8d
2 changed files with 6 additions and 6 deletions

View File

@@ -972,6 +972,10 @@ export class FlexServer implements GristServer {
let body: string|undefined;
let permitKey: string|undefined;
try {
const user = getUser(req);
const row = {...req.body, UserID: userId, Name: user.name, Email: user.loginEmail};
body = JSON.stringify(mapValues(row, value => [value]));
// Take an extra step to translate the special urlId to a docId. This is helpful to
// allow the same urlId to be used in production and in test. We need the docId for the
// specialPermit below, which we need to be able to write to this doc.
@@ -985,10 +989,6 @@ export class FlexServer implements GristServer {
throw new Error(`Can't resolve ${urlId}: ${docAuth.error}`);
}
const user = getUser(req);
const row = {...req.body, UserID: userId, Name: user.name, Email: user.loginEmail};
body = JSON.stringify(mapValues(row, value => [value]));
permitKey = await this._docWorkerMap.setPermit({docId});
const res = await fetch(await this.getHomeUrlByDocId(docId, `/api/docs/${docId}/tables/Responses/data`), {
method: 'POST',