Browse code

Fix: ATTACH property is already decoded

Thomas Fricker authored on 09/09/2019 10:03:53
Showing 1 changed files
... ...
@@ -324,14 +324,13 @@ public class ICal4jHelper<T extends ICalendarElement> {
324 324
 		if (fmtType != null) {
325 325
 			extension = Mime.getExtension(fmtType.getValue());
326 326
 		}
327
-		String b64 = new String(binary);
328 327
 		String filename = "attachment_" + index + "." + extension;
329 328
 		CalendarOwner calOwner = owner.get();
330 329
 		try (Sudo asUser = new Sudo(calOwner.userUid, calOwner.domainUid)) {
331 330
 			try {
332 331
 				IAttachment service = ServerSideServiceProvider.getProvider(asUser.context).instance(IAttachment.class,
333 332
 						calOwner.domainUid);
334
-				AttachedFile att = service.share(filename, GenericStream.simpleValue(b64, b -> b.getBytes()));
333
+				AttachedFile att = service.share(filename, GenericStream.simpleValue(binary, bin -> bin));
335 334
 				return att;
336 335
 			} catch (ServerFault e) {
337 336
 				logger.info("Cannot attach binary file as attachment: {}", e.getMessage());