From e86ce8fc38fcdec9de9b8d7b68b9ce8c7cd4b3d6 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Mon, 13 May 2024 08:45:03 -0400 Subject: [PATCH] add defensive logic to route parsing --- Oqtane.Shared/Models/Route.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Oqtane.Shared/Models/Route.cs b/Oqtane.Shared/Models/Route.cs index b5a608f3..87577c02 100644 --- a/Oqtane.Shared/Models/Route.cs +++ b/Oqtane.Shared/Models/Route.cs @@ -43,13 +43,19 @@ namespace Oqtane.Models int pos = PagePath.IndexOf("/" + Constants.UrlParametersDelimiter + "/"); if (pos != -1) { - UrlParameters = PagePath.Substring(pos + 3); + if (pos + 3 < PagePath.Length) + { + UrlParameters = PagePath.Substring(pos + 3); + } PagePath = PagePath.Substring(0, pos); } pos = PagePath.IndexOf("/" + Constants.ModuleDelimiter + "/"); if (pos != -1) { - ModuleId = PagePath.Substring(pos + 3); + if (pos + 3 < PagePath.Length) + { + ModuleId = PagePath.Substring(pos + 3); + } PagePath = PagePath.Substring(0, pos); } if (ModuleId.Length != 0)