File tree Expand file tree Collapse file tree 2 files changed +7
-34
lines changed
Expand file tree Collapse file tree 2 files changed +7
-34
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ import getSingleMessage from '../methods/getSingleMessage';
1919import type {
2020 IAttachment ,
2121 IMessage ,
22- IUpload ,
2322 TSendFileMessageFileInfo ,
2423 IServerAttachment ,
2524 TSubscriptionModel ,
@@ -482,46 +481,20 @@ export default class EncryptionRoom {
482481 try {
483482 const content = await this . encryptText ( EJSON . stringify ( { msg : message . msg || '' } ) ) ;
484483
485- return {
484+ const encryptedMessage = {
486485 ...message ,
487486 t : E2E_MESSAGE_TYPE ,
488487 e2e : E2E_STATUS . PENDING ,
489488 e2eMentions : getE2EEMentions ( message . msg ) ,
490489 content
491- } ;
492- } catch ( e ) {
493- // Do nothing
494- console . error ( e ) ;
495- }
490+ } as IMessage ;
496491
497- return message ;
498- } ;
499-
500- // Encrypt upload
501- encryptUpload = async ( message : IUpload ) => {
502- if ( ! this . ready ) {
503- return message ;
504- }
492+ delete encryptedMessage . msg ;
505493
506- try {
507- let description = '' ;
508-
509- if ( message . description ) {
510- const encryptedResult = await this . encryptText ( EJSON . stringify ( { msg : message . description } ) ) ;
511- description =
512- encryptedResult . algorithm === 'rc.v1.aes-sha2'
513- ? encryptedResult . ciphertext
514- : EJSON . stringify ( { kid : encryptedResult . kid , iv : encryptedResult . iv , ciphertext : encryptedResult . ciphertext } ) ;
515- }
516-
517- return {
518- ...message ,
519- t : E2E_MESSAGE_TYPE ,
520- e2e : E2E_STATUS . PENDING ,
521- description
522- } ;
523- } catch {
494+ return encryptedMessage ;
495+ } catch ( e ) {
524496 // Do nothing
497+ console . error ( e ) ;
525498 }
526499
527500 return message ;
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export async function sendFileMessageV2(
7373 'Content-Type' : 'application/json'
7474 } ,
7575 body : JSON . stringify ( {
76- msg : file . msg || undefined ,
76+ msg : ( content ? '' : file . msg ) || undefined ,
7777 tmid : tmid || undefined ,
7878 description : file . description || undefined ,
7979 t : content ? 'e2e' : undefined ,
You can’t perform that action at this time.
0 commit comments