+
+ private List<Message.Quote.Attachment> parseQuoteAttachments(
+ final List<String> attachmentStrings
+ ) throws UserErrorException {
+ final var attachmentPattern = Pattern.compile("([^:]+)(:([^:]+)(:(.+))?)?");
+ final var attachments = new ArrayList<Message.Quote.Attachment>();
+ for (final var attachment : attachmentStrings) {
+ final var matcher = attachmentPattern.matcher(attachment);
+ if (!matcher.matches()) {
+ throw new UserErrorException("Invalid attachment syntax ("
+ + attachment
+ + ") expected 'contentType[:filename[:previewFile]]'");
+ }
+ attachments.add(new Message.Quote.Attachment(matcher.group(1), matcher.group(3), matcher.group(5)));
+ }
+ return attachments;
+ }