From be38b9639188689765632ea71bb9c83c3d22103c Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 21 Jan 2020 13:52:53 +1100 Subject: [PATCH] fixes up the AddSegmentData endpoint --- src/Umbraco.TestData/SegmentTestController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.TestData/SegmentTestController.cs b/src/Umbraco.TestData/SegmentTestController.cs index bcfdfc4ac4..33badbbb55 100644 --- a/src/Umbraco.TestData/SegmentTestController.cs +++ b/src/Umbraco.TestData/SegmentTestController.cs @@ -62,12 +62,18 @@ namespace Umbraco.TestData if (content == null) return Content($"No content found by id {contentId}"); - if (!content.HasProperty(propertyAlias)) - return Content($"The content by id {contentId} does not contain a property with alias {propertyAlias}"); + if (propertyAlias.IsNullOrWhiteSpace() || !content.HasProperty(propertyAlias)) + return Content($"The content by id {contentId} does not contain a property with alias {propertyAlias ?? "null"}"); if (content.ContentType.VariesByCulture() && culture.IsNullOrWhiteSpace()) return Content($"The content by id {contentId} varies by culture but no culture was specified"); + if (value.IsNullOrWhiteSpace()) + return Content("'value' cannot be null"); + + if (segment.IsNullOrWhiteSpace()) + return Content("'segment' cannot be null"); + content.SetValue(propertyAlias, value, culture, segment); Services.ContentService.Save(content);