Maxlength attribute on macro name

This commit is contained in:
Poornima Nayar
2019-08-29 22:09:25 +01:00
committed by Sebastiaan Janssen
parent 0e3f324cb0
commit 088abae314
2 changed files with 12 additions and 1 deletions

View File

@@ -19,7 +19,8 @@
</div>
<umb-control-group label="@macro_enterMacroName" hide-label="false">
<input type="text" name="itemKey" ng-model="vm.itemKey" class="umb-textstring textstring input-block-level" umb-auto-focus required />
<input type="text" name="itemKey" ng-model="vm.itemKey" class="umb-textstring textstring input-block-level"
umb-auto-focus required maxlength="255" />
</umb-control-group>
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>

View File

@@ -62,6 +62,11 @@ namespace Umbraco.Web.Editors
return this.ReturnErrorResponse("Macro with this alias already exists");
}
if (name == null || name.Length > 255)
{
return this.ReturnErrorResponse("Name cannnot be more than 255 characters in length.");
}
try
{
var macro = new Macro
@@ -149,6 +154,11 @@ namespace Umbraco.Web.Editors
return this.ReturnErrorResponse($"No macro data found in request");
}
if (macroDisplay.Name == null || macroDisplay.Name.Length > 255)
{
return this.ReturnErrorResponse("Name cannnot be more than 255 characters in length.");
}
var macro = _macroService.GetById(int.Parse(macroDisplay.Id.ToString()));
if (macro == null)