diff --git a/src/main/java/de/thm/arsnova/services/QuestionService.java b/src/main/java/de/thm/arsnova/services/QuestionService.java index c22f9b3d8ce16a3ae2626e792c60399ec74f60c5..51d1696ef0f58fec4ed7b0591da2cafc2d38745a 100644 --- a/src/main/java/de/thm/arsnova/services/QuestionService.java +++ b/src/main/java/de/thm/arsnova/services/QuestionService.java @@ -112,15 +112,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis } // convert imageurl to base64 if neccessary - if ("grid".equals(question.getQuestionType())) { - if (question.getImage().startsWith("http")) { - final String base64ImageString = imageUtils.encodeImageToString(question.getImage()); - if (base64ImageString == null) { - throw new BadRequestException(); - } - question.setImage(base64ImageString); - } - + if ("grid".equals(question.getQuestionType()) && !question.getImage().startsWith("http")) { // base64 adds offset to filesize, formula taken from: http://en.wikipedia.org/wiki/Base64#MIME final int fileSize = (int) ((question.getImage().length() - 814) / 1.37); if (fileSize > uploadFileSizeByte) { @@ -827,7 +819,7 @@ public class QuestionService implements IQuestionService, ApplicationEventPublis @PreAuthorize("isAuthenticated()") public List<Question> replaceImageData(final List<Question> questions) { for (Question q : questions) { - if (q.getImage() != null) { + if (q.getImage() != null && q.getImage().startsWith("data:image/")) { q.setImage("true"); } }