[bug] Add stubs for shardkey params until integrators pass these parameters to all requests

This commit is contained in:
Sergey Konovalov
2024-06-10 12:10:43 +03:00
parent 2a2efaf1ca
commit d644a44be7

View File

@ -44,6 +44,10 @@ const constants = require('./../../Common/sources/constants');
const cfgExpSessionAbsolute = ms(config.get('services.CoAuthoring.expire.sessionabsolute'));
//Stubs are needed until integrators pass these parameters to all requests
let shardKeyCached;
let wopiSrcCached;
function getFilePath(storageCfg, strPath) {
const storageFolderPath = storageCfg.fs.folderPath;
return path.join(storageFolderPath, strPath);
@ -142,10 +146,15 @@ async function getSignedUrl(ctx, storageCfg, baseUrl, strPath, urlType, optFilen
url += '?md5=' + encodeURIComponent(md5);
url += '&expires=' + encodeURIComponent(expires);
if (ctx.shardKey) {
shardKeyCached = ctx.shardKey;
url += `&${constants.SHARD_KEY_API_NAME}=${encodeURIComponent(ctx.shardKey)}`;
}
if (ctx.wopiSrc) {
} else if (ctx.wopiSrc) {
wopiSrcCached = ctx.wopiSrc;
url += `&${constants.SHARD_KEY_WOPI_NAME}=${encodeURIComponent(ctx.wopiSrc)}`;
} else if (shardKeyCached) {
url += `&${constants.SHARD_KEY_API_NAME}=${encodeURIComponent(shardKeyCached)}`;
} else if (wopiSrcCached) {
url += `&${constants.SHARD_KEY_WOPI_NAME}=${encodeURIComponent(wopiSrcCached)}`;
}
url += '&filename=' + userFriendlyName;
return url;