mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[fix] Add support for tenant-aware persistent storage in the static router; Fix bug 79463
This commit is contained in:
@ -86,7 +86,8 @@ function createCacheMiddleware(prefix, rootPath, cfgStorage, secret, rout) {
|
|||||||
const ctx = new operationContext.Context();
|
const ctx = new operationContext.Context();
|
||||||
ctx.initFromRequest(req);
|
ctx.initFromRequest(req);
|
||||||
await ctx.initTenantCache();
|
await ctx.initTenantCache();
|
||||||
const tenantStorageCfg = ctx.getCfg('storage', cfgStorage);
|
const configKey = rout === cfgForgottenFiles || rout === cfgErrorFiles ? 'persistentStorage' : 'storage';
|
||||||
|
const tenantStorageCfg = ctx.getCfg(configKey, cfgStorage);
|
||||||
|
|
||||||
const urlParsed = urlModule.parse(req.url, true);
|
const urlParsed = urlModule.parse(req.url, true);
|
||||||
const {md5, expires} = urlParsed.query;
|
const {md5, expires} = urlParsed.query;
|
||||||
@ -160,7 +161,7 @@ for (const i in cfgStaticContent) {
|
|||||||
if (storage.needServeStatic() || tenantManager.isMultitenantMode()) {
|
if (storage.needServeStatic() || tenantManager.isMultitenantMode()) {
|
||||||
initCacheRouter(cfgCacheStorage, [cfgCacheStorage.cacheFolderName]);
|
initCacheRouter(cfgCacheStorage, [cfgCacheStorage.cacheFolderName]);
|
||||||
}
|
}
|
||||||
if (storage.needServeStatic(cfgForgottenFiles)) {
|
if (storage.needServeStatic(cfgForgottenFiles) || tenantManager.isMultitenantMode()) {
|
||||||
let persistentRouts = [cfgForgottenFiles, cfgErrorFiles];
|
let persistentRouts = [cfgForgottenFiles, cfgErrorFiles];
|
||||||
persistentRouts = persistentRouts.filter(rout => {
|
persistentRouts = persistentRouts.filter(rout => {
|
||||||
return rout && rout.length > 0;
|
return rout && rout.length > 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user