Merge pull request #1551 from GetStream/fix/handle-enrich-url-error

This commit is contained in:
Sahil Kumar
2023-05-15 17:15:49 +05:30
committed by GitHub
2 changed files with 9 additions and 2 deletions
@@ -7,6 +7,9 @@
- [[#1548]](https://github.com/GetStream/stream-chat-flutter/issues/1548) Fixed `StreamMessageInput` urlRegex only
matching the
lowercase `http(s)|ftp`.
- [[#1542]](https://github.com/GetStream/stream-chat-flutter/issues/1542) Handle error thrown in `StreamMessageInput`
when unable to fetch a
link preview.
## 6.1.0
@@ -1104,8 +1104,12 @@ class StreamMessageInputState extends State<StreamMessageInput>
var response = _ogAttachmentCache[url];
if (response == null) {
final client = StreamChat.of(context).client;
response = await client.enrichUrl(url);
_ogAttachmentCache[url] = response;
try {
response = await client.enrichUrl(url);
_ogAttachmentCache[url] = response;
} catch (e, stk) {
return Future.error(e, stk);
}
}
return response;
}