adds notes

This commit is contained in:
Shannon
2021-01-13 13:59:34 +11:00
parent 52642a3914
commit 5afa49f170
2 changed files with 10 additions and 3 deletions

View File

@@ -55,9 +55,15 @@ namespace Umbraco.Web
{
if (virtualPath.InvariantStartsWith(_appPathPrefix)
&& (virtualPath.Length == _appPathPrefix.Length || virtualPath[_appPathPrefix.Length] == '/'))
{
virtualPath = virtualPath.Substring(_appPathPrefix.Length);
}
if (virtualPath.Length == 0)
{
virtualPath = "/";
}
return virtualPath;
}
@@ -88,9 +94,8 @@ namespace Umbraco.Web
// ie no virtual directory, no .aspx, lowercase...
public Uri UriToUmbraco(Uri uri)
{
// TODO: Ideally we do this witout so many string allocations, we can use
// techniques like StringSegment and Span. This is critical code that executes on every request.
// not really sure we need ToLower.
// TODO: This is critical code that executes on every request, we should
// look into if all of this is necessary? not really sure we need ToLower?
// note: no need to decode uri here because we're returning a uri
// so it will be re-encoded anyway

View File

@@ -67,6 +67,8 @@ namespace Umbraco.Core
// cannot get .AbsolutePath on relative uri (InvalidOperation)
var s = uri.OriginalString;
// TODO: Shouldn't this just use Uri.GetLeftPart?
var posq = s.IndexOf("?", StringComparison.Ordinal);
var posf = s.IndexOf("#", StringComparison.Ordinal);
var pos = posq > 0 ? posq : (posf > 0 ? posf : 0);