diff --git a/Olive.Mvc/Extentions/Extensions.UrlHelpers.cs b/Olive.Mvc/Extentions/Extensions.UrlHelpers.cs index bef281fc..938ecadd 100644 --- a/Olive.Mvc/Extentions/Extensions.UrlHelpers.cs +++ b/Olive.Mvc/Extentions/Extensions.UrlHelpers.cs @@ -49,6 +49,13 @@ public static string AsSafeZippedUrl(this string url) => "..." + url.OrEmpty().T .Replace("/", "_") .Replace("=", "-"); + /// + /// Gets the url decrypted from gzipped and safe base64. + /// + public static string FromSafeZippedUrl(this string url) => url.StartsWith("...") + ? url.Substring(3).Replace("~", "+").Replace("_", "/").Replace("-", "=").FromGZippedBase64() + : url; + public static string Current(this IUrlHelper @this, object queryParameters) { if (queryParameters == null) return Current(@this); @@ -87,7 +94,7 @@ public static string ReturnUrl(this IUrlHelper @this) // Using Safe Encode? if (url.StartsWith("...")) - url = url.Substring(3).Replace("~", "+").Replace("_", "/").Replace("-", "=").FromGZippedBase64(); + url = url.FromSafeZippedUrl(); if (!@this.IsLocalUrl(url)) throw new Exception(url + " is not a valid ReturnUrl as it's external and so unsafe."); diff --git a/Olive.Mvc/Olive.Mvc.csproj b/Olive.Mvc/Olive.Mvc.csproj index 4264413f..9bbf2168 100644 --- a/Olive.Mvc/Olive.Mvc.csproj +++ b/Olive.Mvc/Olive.Mvc.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - 3.1.152 + 3.1.153