Skip to content

Commit

Permalink
prevent instant messages with empty body / content. close #2174
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 5, 2023
1 parent 8b886d2 commit 9872c0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ public Response submitMessage(RestfulInstantMessageV7 msg) {

try {
if (msg.getSender() == null || "".equals(msg.getSender())) {
log.error("Can not submit new messgae - no sender given");
log.error("Can not submit new message - no sender given");
return Response.serverError().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ public class MessagingService implements MessagingServiceRemote, MessagingServic
@Override
@RolesAllowed({"loginRole"})
public InstantMessage submitMessage(InstantMessage message) throws Exception {

if(message.getContent()==null || message.getContent().trim().isEmpty())
throw new Exception("Nachricht ohne Inhalt");

StringGenerator idGen = new StringGenerator();
String messageId=idGen.getID().toString();
message.setId(messageId);
Expand Down

0 comments on commit 9872c0e

Please sign in to comment.