Merge pull request #1207 from GetStream/fix/url_enrich_logic

fix(ui): The URL enrichment logic does not allow path or query params in URL
This commit is contained in:
Salvatore Giordano
2022-06-15 13:39:57 +02:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
@@ -8,6 +8,7 @@
- Fix commands resetting the `StreamMessageInputController.value`.
- [[#996]](https://github.com/GetStream/stream-chat-flutter/issues/996) Videos break bottom photo
carousal.
- Fix: URLs with path and/or query params are not enriched.
✅ Added
@@ -998,7 +998,10 @@ class StreamMessageInputState extends State<StreamMessageInput>
_lastSearchedContainsUrlText = value;
final matchedUrls = _urlRegex.allMatches(value).toList()
..removeWhere((it) => it.group(0)?.split('.').last.isValidTLD() == false);
..removeWhere((it) {
final _parsedMatch = Uri.tryParse(it.group(0) ?? '')?.withScheme;
return _parsedMatch?.host.split('.').last.isValidTLD() == false;
});
// Reset the og attachment if the text doesn't contain any url
if (matchedUrls.isEmpty ||