👔 Update link preview match regex

This commit is contained in:
2025-08-18 21:17:00 +08:00
parent 66eadf96b0
commit c056938b6e
2 changed files with 2 additions and 2 deletions

View File

@@ -20,7 +20,7 @@ public partial class ChatService(
{
private const string ChatFileUsageIdentifier = "chat";
[GeneratedRegex(@"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]")]
[GeneratedRegex(@"https?://(?!.*\.\w{1,6}(?:[#?]|$))[^\s]+", RegexOptions.IgnoreCase)]
private static partial Regex GetLinkRegex();
/// <summary>

View File

@@ -283,7 +283,7 @@ public partial class PostService(
return post;
}
[GeneratedRegex(@"https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]")]
[GeneratedRegex(@"https?://(?!.*\.\w{1,6}(?:[#?]|$))[^\s]+", RegexOptions.IgnoreCase)]
private static partial Regex GetLinkRegex();
public async Task<Post> PreviewPostLinkAsync(Post item)