fix: Backwards compatibility on file upload (#5663)
This commit is contained in:
parent
94845cbfd2
commit
7c448222e1
|
@ -29,6 +29,7 @@ import {
|
||||||
E2E_STATUS
|
E2E_STATUS
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import { Services } from '../services';
|
import { Services } from '../services';
|
||||||
|
import { compareServerVersion } from '../methods/helpers';
|
||||||
|
|
||||||
class Encryption {
|
class Encryption {
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
|
@ -467,7 +468,8 @@ class Encryption {
|
||||||
|
|
||||||
const roomE2E = await this.getRoomInstance(rid);
|
const roomE2E = await this.getRoomInstance(rid);
|
||||||
|
|
||||||
if ('path' in message) {
|
const { version: serverVersion } = store.getState().server;
|
||||||
|
if ('path' in message && compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '6.8.0')) {
|
||||||
return roomE2E.encryptUpload(message);
|
return roomE2E.encryptUpload(message);
|
||||||
}
|
}
|
||||||
return roomE2E.encrypt(message);
|
return roomE2E.encrypt(message);
|
||||||
|
|
|
@ -12,6 +12,8 @@ import FileUpload from './helpers/fileUpload';
|
||||||
import { IFileUpload } from './helpers/fileUpload/interfaces';
|
import { IFileUpload } from './helpers/fileUpload/interfaces';
|
||||||
import log from './helpers/log';
|
import log from './helpers/log';
|
||||||
import { E2E_MESSAGE_TYPE } from '../constants';
|
import { E2E_MESSAGE_TYPE } from '../constants';
|
||||||
|
import { store } from '../store/auxStore';
|
||||||
|
import { compareServerVersion } from './helpers';
|
||||||
|
|
||||||
const uploadQueue: { [index: string]: StatefulPromise<FetchBlobResponse> } = {};
|
const uploadQueue: { [index: string]: StatefulPromise<FetchBlobResponse> } = {};
|
||||||
|
|
||||||
|
@ -118,7 +120,8 @@ export function sendFileMessage(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (encryptedFileInfo.t === E2E_MESSAGE_TYPE) {
|
const { version: serverVersion } = store.getState().server;
|
||||||
|
if (encryptedFileInfo.t === E2E_MESSAGE_TYPE && compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '6.8.0')) {
|
||||||
formData.push({
|
formData.push({
|
||||||
name: 't',
|
name: 't',
|
||||||
data: encryptedFileInfo.t
|
data: encryptedFileInfo.t
|
||||||
|
|
Loading…
Reference in New Issue