mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
This is caused by a weird buggy behavior from ASP.NET Core concerning path value decoding. (More information on https://github.com/dotnet/aspnetcore/issues/14170#issuecomment-533342396) This hasn't been fixed for a while, and the dotnet team keeps reporting it over and over.
This commit is contained in:
parent
523654f2eb
commit
219d03b8dd
2 changed files with 18 additions and 1 deletions
|
@ -265,8 +265,11 @@ namespace BTCPayServer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var escapedItemId = Extensions.UnescapeBackSlashUriString(itemCode);
|
||||||
var item = items.FirstOrDefault(item1 =>
|
var item = items.FirstOrDefault(item1 =>
|
||||||
item1.Id.Equals(itemCode, StringComparison.InvariantCultureIgnoreCase));
|
item1.Id.Equals(itemCode, StringComparison.InvariantCultureIgnoreCase) ||
|
||||||
|
item1.Id.Equals(escapedItemId, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
if (item is null ||
|
if (item is null ||
|
||||||
item.Inventory <= 0 ||
|
item.Inventory <= 0 ||
|
||||||
(item.PaymentMethods?.Any() is true &&
|
(item.PaymentMethods?.Any() is true &&
|
||||||
|
|
|
@ -36,6 +36,20 @@ namespace BTCPayServer
|
||||||
{
|
{
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unescape Uri string for %2F
|
||||||
|
/// See details at: https://github.com/dotnet/aspnetcore/issues/14170#issuecomment-533342396
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uriString">The Uri string.</param>
|
||||||
|
/// <returns>Unescaped back slash Uri string.</returns>
|
||||||
|
public static string UnescapeBackSlashUriString(string uriString)
|
||||||
|
{
|
||||||
|
if (uriString == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return uriString.Replace("%2f", "%2F").Replace("%2F", "/");
|
||||||
|
}
|
||||||
public static bool IsValidEmail(this string email)
|
public static bool IsValidEmail(this string email)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(email))
|
if (string.IsNullOrEmpty(email))
|
||||||
|
|
Loading…
Add table
Reference in a new issue