fix: Avoid invalid url
This commit is contained in:
@@ -1498,16 +1498,20 @@ class ChannelClientState {
|
|||||||
if (url == null || !url.contains('')) {
|
if (url == null || !url.contains('')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final uri = Uri.parse(url);
|
try {
|
||||||
if (!uri.host.endsWith('stream-io-cdn.com') ||
|
final uri = Uri.parse(url);
|
||||||
uri.queryParameters['Expires'] == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
final secondsFromEpoch =
|
|
||||||
int.parse(uri.queryParameters['Expires']!);
|
|
||||||
final expiration =
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(secondsFromEpoch * 1000);
|
|
||||||
return expiration.isBefore(DateTime.now());
|
|
||||||
}))
|
}))
|
||||||
.map((e) => e.id)
|
.map((e) => e.id)
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user