fix: Backwards compatibility on file upload (#5663)

This commit is contained in:
Diego Mello 2024-04-25 15:13:41 -03:00 committed by GitHub
parent 94845cbfd2
commit 7c448222e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ import {
E2E_STATUS
} from '../constants';
import { Services } from '../services';
import { compareServerVersion } from '../methods/helpers';
class Encryption {
ready: boolean;
@ -467,7 +468,8 @@ class Encryption {
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.encrypt(message);

View File

@ -12,6 +12,8 @@ import FileUpload from './helpers/fileUpload';
import { IFileUpload } from './helpers/fileUpload/interfaces';
import log from './helpers/log';
import { E2E_MESSAGE_TYPE } from '../constants';
import { store } from '../store/auxStore';
import { compareServerVersion } from './helpers';
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({
name: 't',
data: encryptedFileInfo.t