Browse Source

implemented test to prevent blank tags

feature/brute_force_protection
Stephan Richter 2 months ago
parent
commit
53db593936
  1. 1
      frontend/src/routes/tags/TagList.svelte
  2. 2
      tags/src/main/java/de/srsoftware/umbrella/tags/TagModule.java

1
frontend/src/routes/tags/TagList.svelte

@ -17,6 +17,7 @@ @@ -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);

2
tags/src/main/java/de/srsoftware/umbrella/tags/TagModule.java

@ -93,7 +93,7 @@ public class TagModule extends BaseHandler implements TagService { @@ -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);

Loading…
Cancel
Save