[backend/core] Fix profile field verification for MFM link node fields
This commit is contained in:
parent
9d480e3fba
commit
5bf14a6a06
1 changed files with 10 additions and 2 deletions
|
@ -1183,9 +1183,17 @@ public class UserService(
|
||||||
|
|
||||||
foreach (var userProfileField in user.UserProfile!.Fields)
|
foreach (var userProfileField in user.UserProfile!.Fields)
|
||||||
{
|
{
|
||||||
|
var url = userProfileField.Value;
|
||||||
|
if (url.StartsWith('[') && url.EndsWith(')'))
|
||||||
|
{
|
||||||
|
var idx = url.IndexOf("](", StringComparison.Ordinal);
|
||||||
|
if (idx != -1 && url.Length >= idx + "https://".Length)
|
||||||
|
url = url[(idx + 2)..^1];
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!userProfileField.Value.StartsWith("https://")
|
!url.StartsWith("https://")
|
||||||
|| !Uri.TryCreate(userProfileField.Value, UriKind.Absolute, out var uri)
|
|| !Uri.TryCreate(url, UriKind.Absolute, out var uri)
|
||||||
|| uri is not { Scheme: "https" }
|
|| uri is not { Scheme: "https" }
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue