|
|
|
@ -1098,7 +1098,8 @@ export class DocWorkerApi {
|
|
|
|
|
if (req.body.sourceDocId) {
|
|
|
|
|
options.sourceDocId = await this._confirmDocIdForRead(req, String(req.body.sourceDocId));
|
|
|
|
|
// Make sure that if we wanted to download the full source, we would be allowed.
|
|
|
|
|
const result = await fetch(this._grist.getHomeUrl(req, `/api/docs/${options.sourceDocId}/download?dryrun=1`), {
|
|
|
|
|
const homeUrl = this._grist.getHomeInternalUrl(req, `/api/docs/${options.sourceDocId}/download?dryrun=1`);
|
|
|
|
|
const result = await fetch(homeUrl, {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
headers: {
|
|
|
|
|
...getTransitiveHeaders(req),
|
|
|
|
@ -1111,7 +1112,7 @@ export class DocWorkerApi {
|
|
|
|
|
}
|
|
|
|
|
// We should make sure the source document has flushed recently.
|
|
|
|
|
// It may not be served by the same worker, so work through the api.
|
|
|
|
|
await fetch(this._grist.getHomeUrl(req, `/api/docs/${options.sourceDocId}/flush`), {
|
|
|
|
|
await fetch(this._grist.getHomeInternalUrl(req, `/api/docs/${options.sourceDocId}/flush`), {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
...getTransitiveHeaders(req),
|
|
|
|
@ -1170,7 +1171,7 @@ export class DocWorkerApi {
|
|
|
|
|
const showDetails = isAffirmative(req.query.detail);
|
|
|
|
|
const docSession = docSessionFromRequest(req);
|
|
|
|
|
const {states} = await this._getStates(docSession, activeDoc);
|
|
|
|
|
const ref = await fetch(this._grist.getHomeUrl(req, `/api/docs/${req.params.docId2}/states`), {
|
|
|
|
|
const ref = await fetch(this._grist.getHomeInternalUrl(req, `/api/docs/${req.params.docId2}/states`), {
|
|
|
|
|
headers: {
|
|
|
|
|
...getTransitiveHeaders(req),
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
@ -1199,7 +1200,7 @@ export class DocWorkerApi {
|
|
|
|
|
|
|
|
|
|
// Calculate changes from the (common) parent to the current version of the other document.
|
|
|
|
|
const url = `/api/docs/${req.params.docId2}/compare?left=${parent.h}`;
|
|
|
|
|
const rightChangesReq = await fetch(this._grist.getHomeUrl(req, url), {
|
|
|
|
|
const rightChangesReq = await fetch(this._grist.getHomeInternalUrl(req, url), {
|
|
|
|
|
headers: {
|
|
|
|
|
...getTransitiveHeaders(req),
|
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
|