implemented test to prevent blank tags

This commit is contained in:
2025-08-25 18:27:08 +02:00
parent ac5f5b6b6b
commit 53db593936
2 changed files with 2 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
let router = useTinyRouter();
async function addTag(){
if (!newTag) return;
if (!id) {
// when creating elements, they don`t have an id, yet
tags.push(newTag);

View File

@@ -93,7 +93,7 @@ public class TagModule extends BaseHandler implements TagService {
var head = path.pop();
long entityId = Long.parseLong(head);
var json = json(ex);
if (!(json.has(TAG) && json.get(TAG) instanceof String tag)) throw missingFieldException(TAG);
if (!(json.has(TAG) && json.get(TAG) instanceof String tag && !tag.isBlank())) throw missingFieldException(TAG);
List<Long> userList = null;
if (!json.has(USER_LIST)) throw missingFieldException(USER_LIST);
var ul = json.isNull(USER_LIST) ? null : json.get(USER_LIST);