Merge pull request #829 from jiahan5/patch-1
fix(llc): avoid invalid url
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
|
||||
- [[#846]](https://github.com/GetStream/stream-chat-flutter/issues/846) Fixed `message.ownReactions` getting truncated when receiving a reaction event.
|
||||
|
||||
🐞 Fixed
|
||||
|
||||
- Add check for invalid image URLs
|
||||
|
||||
## 3.3.1
|
||||
|
||||
🐞 Fixed
|
||||
@@ -769,4 +773,4 @@
|
||||
|
||||
## 0.0.2
|
||||
|
||||
- first beta version
|
||||
- first beta version
|
||||
|
||||
@@ -1532,16 +1532,21 @@ class ChannelClientState {
|
||||
if (url == null || !url.contains('')) {
|
||||
return false;
|
||||
}
|
||||
final uri = Uri.parse(url);
|
||||
if (!uri.host.endsWith('stream-io-cdn.com') ||
|
||||
uri.queryParameters['Expires'] == null) {
|
||||
try {
|
||||
final uri = Uri.parse(url);
|
||||
if (!uri.host.endsWith('stream-io-cdn.com') ||
|
||||
uri.queryParameters['Expires'] == null) {
|
||||
return false;
|
||||
}
|
||||
final secondsFromEpoch =
|
||||
int.parse(uri.queryParameters['Expires']!);
|
||||
final expiration = DateTime.fromMillisecondsSinceEpoch(
|
||||
secondsFromEpoch * 1000,
|
||||
);
|
||||
return expiration.isBefore(DateTime.now());
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
final secondsFromEpoch =
|
||||
int.parse(uri.queryParameters['Expires']!);
|
||||
final expiration =
|
||||
DateTime.fromMillisecondsSinceEpoch(secondsFromEpoch * 1000);
|
||||
return expiration.isBefore(DateTime.now());
|
||||
}))
|
||||
.map((e) => e.id)
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user