Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

ValidateSeName - prevent looping

supportedf4e66707ca
diff --git a/src/Business/Grand.Business.Core/Extensions/SeoExtensions.cs b/src/Business/Grand.Business.Core/Extensions/SeoExtensions.cs
index efec5df4c..a22359180 100644
--- a/src/Business/Grand.Business.Core/Extensions/SeoExtensions.cs
+++ b/src/Business/Grand.Business.Core/Extensions/SeoExtensions.cs
@@ -113,7 +113,7 @@ namespace Grand.Business.Core.Extensions
//ensure this sename is not reserved yet
var entityName = typeof(T).Name;
- var i = 2;
+ var i = 1;
var tempSeName = seName;
while (true)
{
@@ -128,6 +128,11 @@ namespace Grand.Business.Core.Extensions
tempSeName = string.Format("{0}-{1}", seName, i);
i++;
+ if(i > 4)
+ {
+ tempSeName = string.Format("{0}-{1}", seName, Guid.NewGuid());
+ break;
+ }
}
seName = tempSeName;