When checking the active item for a a menu we check it matches the current url, the url is in the format admin/project/2019%20a1/project-brief. This is because 2019 a1 is the project number and gets encoded when used in the url.
When using Url.Index to create the url it is not yet encoded. This is then used to compare the url with Context.Current.Request().ToPathAndQuery(); which is encoded. In the example we would end up with admin/project/2019%20a1/project-brief (from ToPathAndQuery()) compared with admin/project/2019 a1/project-brief (from Url.Index()) which returns false when it should return true.
If we use UrlDecode() on currentUrl before making the comparison I believe this solves the issue.
https://github.com/Geeksltd/Olive/blob/e83d06b3d64e6dbfeb2c417bdac86f547fc89402/Olive.Mvc/Utilities/MenuItem.cs#L15-L19
When checking the active item for a a menu we check it matches the current url, the url is in the format
admin/project/2019%20a1/project-brief
. This is because2019 a1
is the project number and gets encoded when used in the url.When using Url.Index to create the url it is not yet encoded. This is then used to compare the url with
Context.Current.Request().ToPathAndQuery();
which is encoded. In the example we would end up withadmin/project/2019%20a1/project-brief
(fromToPathAndQuery()
) compared withadmin/project/2019 a1/project-brief
(fromUrl.Index()
) which returns false when it should return true.If we use
UrlDecode()
oncurrentUrl
before making the comparison I believe this solves the issue.