File tree Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Expand file tree Collapse file tree 5 files changed +51
-2
lines changed Original file line number Diff line number Diff line change 53
53
# direnv
54
54
.envrc
55
55
.direnv
56
+ .aider *
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use deltachat::chat::ChatVisibility;
8
8
use deltachat:: contact:: Contact ;
9
9
use deltachat:: context:: Context ;
10
10
use deltachat:: download;
11
+ use deltachat:: log:: LogExt as _;
11
12
use deltachat:: message:: Message ;
12
13
use deltachat:: message:: MsgId ;
13
14
use deltachat:: message:: Viewtype ;
@@ -143,7 +144,10 @@ impl MessageObject {
143
144
let override_sender_name = message. get_override_sender_name ( ) ;
144
145
145
146
let webxdc_info = if message. get_viewtype ( ) == Viewtype :: Webxdc {
146
- Some ( WebxdcMessageInfo :: get_for_message ( context, msg_id) . await ?)
147
+ WebxdcMessageInfo :: get_for_message ( context, msg_id)
148
+ . await
149
+ . log_err ( context)
150
+ . ok ( )
147
151
} else {
148
152
None
149
153
} ;
Original file line number Diff line number Diff line change 3
3
"dependencies" : {
4
4
"@deltachat/tiny-emitter" : " 3.0.0" ,
5
5
"isomorphic-ws" : " ^4.0.1" ,
6
+ "tmp" : " ^0.2.3" ,
6
7
"yerpc" : " ^0.6.2"
7
8
},
8
9
"devDependencies" : {
Original file line number Diff line number Diff line change 1
- import { strictEqual } from "assert" ;
2
1
import chai , { assert , expect } from "chai" ;
3
2
import chaiAsPromised from "chai-as-promised" ;
3
+ import { fileSync } from "tmp" ;
4
4
chai . use ( chaiAsPromised ) ;
5
5
import { StdioDeltaChat as DeltaChat } from "../deltachat.js" ;
6
6
@@ -100,6 +100,32 @@ describe("basic tests", () => {
100
100
} ) ;
101
101
} ) ;
102
102
103
+ describe ( "webxdc" , function ( ) {
104
+ let invalidXdcPath : string ;
105
+ let accountId : number ;
106
+
107
+ before ( async ( ) => {
108
+ const tmpFile = fileSync ( { postfix : ".xdc" } ) ;
109
+ invalidXdcPath = tmpFile . name ;
110
+ accountId = await dc . rpc . addAccount ( ) ;
111
+ } ) ;
112
+
113
+ it ( "should be able to draft set an invalid xdc" , async function ( ) {
114
+ const chat = await dc . rpc . createGroupChat ( accountId , "xdc" , false ) ;
115
+ await expect (
116
+ dc . rpc . miscSetDraft (
117
+ accountId ,
118
+ chat ,
119
+ "" ,
120
+ invalidXdcPath ,
121
+ "invalid.xdc" ,
122
+ null ,
123
+ null
124
+ )
125
+ ) . to . be . eventually . rejectedWith ( "Invalid xdc" ) ;
126
+ } ) ;
127
+ } ) ;
128
+
103
129
describe ( "configuration" , function ( ) {
104
130
let accountId : number ;
105
131
before ( async ( ) => {
Original file line number Diff line number Diff line change @@ -124,6 +124,23 @@ async fn test_send_invalid_webxdc() -> Result<()> {
124
124
Ok ( ( ) )
125
125
}
126
126
127
+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
128
+ async fn test_set_draft_invalid_webxdc ( ) -> Result < ( ) > {
129
+ let t = TestContext :: new_alice ( ) . await ;
130
+ let chat_id = create_group_chat ( & t, ProtectionStatus :: Unprotected , "foo" ) . await ?;
131
+
132
+ let mut instance = create_webxdc_instance (
133
+ & t,
134
+ "invalid-no-zip-but-7z.xdc" ,
135
+ include_bytes ! ( "../../test-data/webxdc/invalid-no-zip-but-7z.xdc" ) ,
136
+ ) ?;
137
+
138
+ // draft should not fail
139
+ chat_id. set_draft ( & t, Some ( & mut instance) ) . await ?;
140
+ chat_id. get_draft ( & t) . await . unwrap ( ) ;
141
+ Ok ( ( ) )
142
+ }
143
+
127
144
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
128
145
async fn test_send_special_webxdc_format ( ) -> Result < ( ) > {
129
146
let t = TestContext :: new_alice ( ) . await ;
You can’t perform that action at this time.
0 commit comments