Remove context for download filenames

pull/872/head
CamilleLegeron 3 months ago
parent 3a3c5bf94a
commit 928f60dc89

@ -255,7 +255,6 @@ GRIST_HOST | hostname to use when listening on a port.
GRIST_HTTPS_PROXY | if set, use this proxy for webhook payload delivery.
GRIST_ID_PREFIX | for subdomains of form o-*, expect or produce o-${GRIST_ID_PREFIX}*.
GRIST_IGNORE_SESSION | if set, Grist will not use a session for authentication.
GRIST_INCLUDE_CONTEXT_TO_DOWNLOAD_FILENAMES | if set to true, the organization and the workspace names are added to the downloaded Grist file names, defaults to `false`.
GRIST_INST_DIR | path to Grist instance configuration files, for Grist server.
GRIST_LIST_PUBLIC_SITES | if set to true, sites shared with the public will be listed for anonymous users. Defaults to false.
GRIST_MANAGED_WORKERS | if set, Grist can assume that if a url targeted at a doc worker returns a 404, that worker is gone

@ -1734,15 +1734,11 @@ export class DocWorkerApi {
}
private async _getDownloadFilename(req: Request, tableId?: string): Promise<string> {
const addContext = isAffirmative(process.env.GRIST_INCLUDE_CONTEXT_TO_DOWNLOAD_FILENAMES || false);
// Query DB for doc metadata to get the doc data.
const doc = await this._dbManager.getDoc(req);
const docTitle = doc.name;
const prefix = addContext ? `${doc.workspace?.org?.name}_${doc.workspace?.name}_` : '';
const sufix = tableId ? (tableId === docTitle ? '' : `_${tableId}`) : '';
const filename = prefix + (optStringParam(req.query.title, 'title') || docTitle || 'document') + sufix;
const filename = optStringParam(req.query.title, 'title') || docTitle + sufix || 'document';
return filename;
}

Loading…
Cancel
Save