Skip to content

Commit

Permalink
Fix building of query string parameters in UrlHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
exyi committed Dec 15, 2023
1 parent 2589a6c commit 73bd4bb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Framework/Framework/Routing/UrlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static string AppendQueryParam(ref string urlSuffix, string name, string

return (!hasValue) ?
urlSuffix += Uri.EscapeDataString(name) :
urlSuffix += $"{Uri.EscapeDataString(name)}={value}";
urlSuffix += $"{Uri.EscapeDataString(name)}={Uri.EscapeDataString(value)}";

Check failure on line 58 in src/Framework/Framework/Routing/UrlHelper.cs

View workflow job for this annotation

GitHub Actions / Build published projects without warnings (Release)

Possible null reference argument for parameter 'stringToEscape' in 'string Uri.EscapeDataString(string stringToEscape)'.

Check failure on line 58 in src/Framework/Framework/Routing/UrlHelper.cs

View workflow job for this annotation

GitHub Actions / Build published projects without warnings (Release)

Possible null reference argument for parameter 'stringToEscape' in 'string Uri.EscapeDataString(string stringToEscape)'.

Check failure on line 58 in src/Framework/Framework/Routing/UrlHelper.cs

View workflow job for this annotation

GitHub Actions / Build published projects without warnings (Debug)

Possible null reference argument for parameter 'stringToEscape' in 'string Uri.EscapeDataString(string stringToEscape)'.

Check failure on line 58 in src/Framework/Framework/Routing/UrlHelper.cs

View workflow job for this annotation

GitHub Actions / Build published projects without warnings (Debug)

Possible null reference argument for parameter 'stringToEscape' in 'string Uri.EscapeDataString(string stringToEscape)'.
}

/// <summary>
Expand Down Expand Up @@ -137,16 +137,15 @@ private static bool ContainsOnlyValidUrlChars(string url)
}
else if (ReflectionUtils.TryGetCustomPrimitiveTypeRegistration(value.GetType()) is { } registration)
{
return Uri.EscapeDataString(registration.ToStringMethod(value));
return registration.ToStringMethod(value);
}
else if (value is IConvertible convertible)
{
return Uri.EscapeDataString(convertible.ToString(CultureInfo.InvariantCulture));
return convertible.ToString(CultureInfo.InvariantCulture);
}
else
{
var strVal = value.ToString();
return strVal == null ? null : Uri.EscapeDataString(strVal);
return value.ToString();
}
}
}
Expand Down

0 comments on commit 73bd4bb

Please sign in to comment.