Skip to content

Commit

Permalink
Check if attachmentDir already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrussler authored Jun 13, 2024
1 parent 09e6437 commit f639304
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/mimeparser/MimeMessageConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,12 @@ public String replace(Matcher m) throws Exception {
Logger.debug("Found %s attachments", attachments.size());

if (!attachments.isEmpty()) {
boolean successfullyCreatedAttachmentDir = attachmentDir.mkdirs();
if (!attachmentDir.exists()) {
boolean successfullyCreatedAttachmentDir = attachmentDir.mkdirs();

if (!successfullyCreatedAttachmentDir) {
throw new IllegalStateException("Failed to create attachment directory");
if (!successfullyCreatedAttachmentDir) {
throw new IllegalStateException("Failed to create attachment directory");
}
}

Logger.info("Extract attachments to %s", attachmentDir.getAbsolutePath());
Expand Down

0 comments on commit f639304

Please sign in to comment.