@@ -171,7 +171,11 @@ impl MediaEventContent for AudioMessageEventContent {
171
171
}
172
172
173
173
fn filename_or_body ( & self ) -> Option < String > {
174
- Some ( self . filename . clone ( ) . unwrap_or_else ( || self . body . clone ( ) ) )
174
+ if let Some ( filename) = & self . filename {
175
+ Some ( filename. clone ( ) )
176
+ } else {
177
+ Some ( self . body . clone ( ) )
178
+ }
175
179
}
176
180
177
181
fn thumbnail_source ( & self ) -> Option < MediaSource > {
@@ -185,7 +189,11 @@ impl MediaEventContent for FileMessageEventContent {
185
189
}
186
190
187
191
fn filename_or_body ( & self ) -> Option < String > {
188
- Some ( self . filename . clone ( ) . unwrap_or_else ( || self . body . clone ( ) ) )
192
+ if let Some ( filename) = & self . filename {
193
+ Some ( filename. clone ( ) )
194
+ } else {
195
+ Some ( self . body . clone ( ) )
196
+ }
189
197
}
190
198
191
199
fn thumbnail_source ( & self ) -> Option < MediaSource > {
@@ -199,7 +207,11 @@ impl MediaEventContent for ImageMessageEventContent {
199
207
}
200
208
201
209
fn filename_or_body ( & self ) -> Option < String > {
202
- self . filename . clone ( )
210
+ if let Some ( filename) = & self . filename {
211
+ Some ( filename. clone ( ) )
212
+ } else {
213
+ Some ( self . body . clone ( ) )
214
+ }
203
215
}
204
216
205
217
fn thumbnail_source ( & self ) -> Option < MediaSource > {
@@ -216,7 +228,11 @@ impl MediaEventContent for VideoMessageEventContent {
216
228
}
217
229
218
230
fn filename_or_body ( & self ) -> Option < String > {
219
- Some ( self . filename . clone ( ) . unwrap_or_else ( || self . body . clone ( ) ) )
231
+ if let Some ( filename) = & self . filename {
232
+ Some ( filename. clone ( ) )
233
+ } else {
234
+ Some ( self . body . clone ( ) )
235
+ }
220
236
}
221
237
222
238
fn thumbnail_source ( & self ) -> Option < MediaSource > {
0 commit comments