mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[feature] Fix bugs; For bug 73737
This commit is contained in:
@ -51,6 +51,7 @@ const cfgStorageName = config.get('storage.name');
|
||||
const cfgEndpoint = config.get('storage.endpoint');
|
||||
const cfgBucketName = config.get('storage.bucketName');
|
||||
const cfgAccessKeyId = config.get('storage.accessKeyId');
|
||||
const cfgUseDirectStorageUrls = config.get('storage.useDirectStorageUrls');
|
||||
const ctx = new operationContext.Context();
|
||||
|
||||
const testFilesNames = {
|
||||
@ -183,8 +184,12 @@ describe('Command service', function () {
|
||||
const createExpected = ({ key, error }) => {
|
||||
const validKey = typeof key === 'string' && error === 0
|
||||
let urlPattern;
|
||||
if ("storage-fs" === cfgStorageName) {
|
||||
urlPattern = 'http://localhost:8000/cache/files/forgotten/--key--/output.docx/output.docx';
|
||||
if ("storage-fs" === cfgStorageName || !cfgUseDirectStorageUrls) {
|
||||
if ("storage-fs" === cfgStorageName) {
|
||||
urlPattern = 'http://localhost:8000/cache/files/forgotten/--key--/output.docx/output.docx';
|
||||
} else {
|
||||
urlPattern = 'http://localhost:8000/storage-cache/files/forgotten/--key--/output.docx/output.docx';
|
||||
}
|
||||
} else if ("storage-s3" === cfgStorageName) {
|
||||
let host = cfgEndpoint.slice(0, "https://".length) + cfgBucketName + "." + cfgEndpoint.slice("https://".length);
|
||||
if (host[host.length - 1] === '/') {
|
||||
@ -192,7 +197,12 @@ describe('Command service', function () {
|
||||
}
|
||||
urlPattern = host + '/files/forgotten/--key--/output.docx';
|
||||
} else {
|
||||
let host = cfgEndpoint.slice(0, "https://".length) + cfgAccessKeyId + "." + cfgEndpoint.slice("https://".length) + '/' + cfgBucketName;
|
||||
let host;
|
||||
if (cfgEndpoint.includes(cfgAccessKeyId)) {
|
||||
host = cfgEndpoint.slice(0, "https://".length) + cfgEndpoint.slice("https://".length) + '/' + cfgBucketName;
|
||||
} else {
|
||||
host = cfgEndpoint.slice(0, "https://".length) + cfgAccessKeyId + "." + cfgEndpoint.slice("https://".length) + '/' + cfgBucketName;
|
||||
}
|
||||
if (host[host.length - 1] === '/') {
|
||||
host = host.slice(0, -1);
|
||||
}
|
||||
|
||||
@ -76,13 +76,16 @@ function getStorageCfg(specialDir) {
|
||||
}
|
||||
|
||||
function request(url) {
|
||||
return new Promise(resolve => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let module = url.startsWith('https') ? https : http;
|
||||
module.get(url, response => {
|
||||
const req = module.get(url, response => {
|
||||
let data = '';
|
||||
response.on('data', _data => (data += _data));
|
||||
response.on('error', error => reject(error));
|
||||
response.on('end', () => resolve(data));
|
||||
});
|
||||
|
||||
req.on('error', error => reject(error));
|
||||
});
|
||||
}
|
||||
function runTestForDir(ctx, isMultitenantMode, specialDir) {
|
||||
|
||||
Reference in New Issue
Block a user