optimize ParseParameters to use native Uri class

This commit is contained in:
sbwalker
2024-02-29 10:09:19 -05:00
parent 76680777ff
commit dd1d0d1cb8
3 changed files with 62 additions and 71 deletions

View File

@ -384,9 +384,7 @@
_path = _name;
}
var fragment = (_path.Contains("?")) ? _path.Substring(_path.IndexOf("?")) : "";
fragment = (_path.Contains("#")) ? _path.Substring(_path.IndexOf("#")) : "";
_path = (!string.IsNullOrEmpty(fragment)) ? _path.Replace(fragment, "") : _path;
(_path, string parameters) = Utilities.ParsePath(_path);
if (_path.Contains("/"))
{
@ -412,7 +410,7 @@
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
}
page.Path += fragment;
page.Path += parameters;
}
else
{

View File

@ -526,9 +526,7 @@
_path = _name;
}
var fragment = (_path.Contains("?")) ? _path.Substring(_path.IndexOf("?")) : "";
fragment = (_path.Contains("#")) ? _path.Substring(_path.IndexOf("#")) : "";
_path = (!string.IsNullOrEmpty(fragment)) ? _path.Replace(fragment, "") : _path;
(_path, string parameters) = Utilities.ParsePath(_path);
if (_path.Contains("/"))
{
@ -554,7 +552,7 @@
_page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
}
}
_page.Path += fragment;
_page.Path += parameters;
}
else
{