Skip to content

Commit

Permalink
Added: Decode Base64 values of email context
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Dec 2, 2024
1 parent e9a18d2 commit 2420deb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Default and Default var in html tags
- Fetch human readable bridgehead for emails
- Email context project bridgeheads variable
- Decode Base64 values of email context
9 changes: 8 additions & 1 deletion src/main/java/de/samply/email/EmailContext.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.samply.email;

import de.samply.app.ProjectManagerConst;
import de.samply.utils.Base64Utils;
import jakarta.annotation.PostConstruct;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -22,7 +23,13 @@ public class EmailContext {
@PostConstruct
public void init() {
log.info("Email Context initialized:");
context.entrySet().stream().forEach(keyValue -> log.info("\t-\t{}: {}", keyValue.getKey(), keyValue.getValue()));
Map<String, String> tempContext = Map.copyOf(context);
context.entrySet().stream().forEach(keyValue -> {
log.info("\t-\t{}: {}", keyValue.getKey(), keyValue.getValue());
Base64Utils.decodeIfNecessary(keyValue.getValue()).ifPresent(value -> tempContext.put(keyValue.getKey(), value));
});
context = tempContext;
}


}

0 comments on commit 2420deb

Please sign in to comment.