Use Array.Empty in WebEncoders (#23677)
This commit is contained in:
parent
df5269fea2
commit
3d5c8ed114
|
|
@ -180,7 +180,7 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
model.ErrorDetails = new ExceptionDetails[0];
|
model.ErrorDetails = Array.Empty<ExceptionDetails>();
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorPage = new ErrorPage(model);
|
var errorPage = new ErrorPage(model);
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ namespace Microsoft.Extensions.Internal
|
||||||
#endif
|
#endif
|
||||||
static class WebEncoders
|
static class WebEncoders
|
||||||
{
|
{
|
||||||
private static readonly byte[] EmptyBytes = new byte[0];
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decodes a base64url-encoded string.
|
/// Decodes a base64url-encoded string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -70,7 +68,7 @@ namespace Microsoft.Extensions.Internal
|
||||||
// Special-case empty input
|
// Special-case empty input
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return EmptyBytes;
|
return Array.Empty<byte>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create array large enough for the Base64 characters, not just shorter Base64-URL-encoded form.
|
// Create array large enough for the Base64 characters, not just shorter Base64-URL-encoded form.
|
||||||
|
|
@ -117,7 +115,7 @@ namespace Microsoft.Extensions.Internal
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return EmptyBytes;
|
return Array.Empty<byte>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumption: input is base64url encoded without padding and contains no whitespace.
|
// Assumption: input is base64url encoded without padding and contains no whitespace.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue