diff --git a/README.md b/README.md
index 59bd47c8..76441116 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ More detailed information is available in the DeveloperGuide.odt in the docs fol
The following commands can be used in the build process.
Updating Maven to a different version:
-`./mvnw wrapper:wrapper -Dmaven=3.9.9
+`./mvnw wrapper:wrapper -Dmaven=3.9.9`
Checking dependency tree:
`./mvnw dependency:tree`
@@ -92,7 +92,7 @@ $ docker build -t openas2:latest .
```
Run the OpenAS2 server, with its network set to "host", so that the WebUI can access the server.
-NOTE: Some users have reported that using --net=host does not work for them and removing it solves the problem..
+NOTE: Some users have reported that using --net=host does not work for them and removing it solves the problem.
```console
$ docker run -it --rm --net=host -p 4080:10080 -p 4081:10081 -p 8443:8080 -v ${PWD}/config:/opt/openas2/config -v ${PWD}/data:/opt/openas2/data openas2:latest
@@ -145,7 +145,7 @@ $ docker compose logs openas2_webui
## Dynamically configure your container using environment variables
-Here is a short explaination how to override properties in the container's `config.xml` file using environment variables.
+Here is a short explanation how to override properties in the container's `config.xml` file using environment variables.
**Prerequisites:**
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 8d2101cf..984a2cb0 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,23 +1,44 @@
# OpenAS2 Server
-# Version 4.7.1
+# Version 4.7.2
# RELEASE NOTES
-----
-The OpenAS2 project is pleased to announce the release of OpenAS2 4.7.1
+The OpenAS2 project is pleased to announce the release of OpenAS2 4.7.2
-The release download file is: OpenAS2Server-4.7.1.zip
+The release download file is: OpenAS2Server-4.7.2.zip
The zip file contains a PDF document (OpenAS2HowTo.pdf) providing information on installing and using the application.
## NOTE: Testing covers Java 11 to 21.
## Java 8 is NO LONGER SUPPORTED.
-Version 4.7.1 - 2025-10-20
-
-This is a minor bufix release.
-1. Fix boolean return values from processMDN method causing wrong log message.
-2. Fix logging WARN message that should have been a TRACE log.
-
-
-##Upgrade Notes
+Version 4.7.2 - 2025-10-23
+
+This is a minor bugfix release.
+
+1. Changes to partnership.xml
+
+ * New optional attribute `quote_send_file_name` for the partnership to specify if
+ the filename which is to be included in header `Content-Disposition: Attachment; filename="filename.ext"` should be quoted or not.
+ Useful for target AS2 servers which are picky about the quotes. Requires `sendfilename="true"` to be set.
+
+ Any value other than "false" will be considered true - default: true (previous behaviour).
+ ````
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ````
+
+## Upgrade Notes
See the openAS2HowTo appendix for the general process on upgrading OpenAS2.
Below are some specific things to focus on depending on which version you are upgrading from.
diff --git a/Server/src/config/partnerships.xml b/Server/src/config/partnerships.xml
index 8071264d..7050e21f 100644
--- a/Server/src/config/partnerships.xml
+++ b/Server/src/config/partnerships.xml
@@ -67,6 +67,13 @@
-->
+
diff --git a/Server/src/main/java/org/openas2/partner/Partnership.java b/Server/src/main/java/org/openas2/partner/Partnership.java
index a91b752d..7f0a97fd 100644
--- a/Server/src/main/java/org/openas2/partner/Partnership.java
+++ b/Server/src/main/java/org/openas2/partner/Partnership.java
@@ -69,6 +69,7 @@ public class Partnership implements Serializable {
public static final String PA_SPLIT_FILE_CONTAINS_HEADER_ROW = "split_file_contains_header_row";
public static final String PA_SPLIT_FILE_NAME_PREFIX = "split_file_name_prefix";
public static final String PA_RESEND_ON_SSL_EXCEPTION = "resend_on_ssl_exception";
+ public static final String PA_QUOTE_SEND_FILE_NAME = "quote_send_file_name"; // Allow disabling the quoting of the filename in header when sendfilename=true is set
// A hopefully temporary key to maintain backwards compatibility
public static final String USE_NEW_CERTIFICATE_LOOKUP_MODE = "use_new_certificate_lookup_mode";
diff --git a/Server/src/main/java/org/openas2/processor/receiver/MessageBuilderModule.java b/Server/src/main/java/org/openas2/processor/receiver/MessageBuilderModule.java
index 47034ed2..fcee1cd5 100644
--- a/Server/src/main/java/org/openas2/processor/receiver/MessageBuilderModule.java
+++ b/Server/src/main/java/org/openas2/processor/receiver/MessageBuilderModule.java
@@ -55,7 +55,9 @@ public abstract class MessageBuilderModule extends BaseReceiverModule {
public static final String PARAM_DEFAULTS = "defaults";
public static final String PARAM_MIMETYPE = "mimetype";
public static final String PARAM_RESEND_MAX_RETRIES = "resend_max_retries";
-
+ // Note: When this option is enabled, you can also configure its quoting using "quote_send_file_name" at partnership-level
+ public static final String PARAM_SEND_FILENAME = "sendfilename";
+
private Logger logger = LoggerFactory.getLogger(MessageBuilderModule.class);
public void init(Session session, Map options) throws OpenAS2Exception {
@@ -398,14 +400,28 @@ public String getMessageContentType(Message msg) throws OpenAS2Exception {
return contentType;
}
- private void setAdditionalMetaData(Message msg, MimeBodyPart mimeBodyPart) throws OpenAS2Exception {
+ // @VisibleForTesting
+ protected void setAdditionalMetaData(Message msg, MimeBodyPart mimeBodyPart) throws OpenAS2Exception {
try {
// add below statement will tell the receiver to save the filename
// as the one sent by sender. 2007-06-01
- String sendFileName = getParameter("sendfilename", false);
+ String sendFileName = getParameter(PARAM_SEND_FILENAME, false);
if (sendFileName != null && sendFileName.equals("true")) {
- String contentDisposition = "Attachment; filename=\"" + msg.getAttribute(FileAttribute.MA_FILENAME) + "\"";
+ // Allow configuration of the quoting at partnership-level
+ String quoteFileName = msg.getPartnership().getAttribute(Partnership.PA_QUOTE_SEND_FILE_NAME);
+
+ String quoteFileNameSign;
+ if ("false".equalsIgnoreCase(quoteFileName)){
+ // Explicitly disabled
+ quoteFileNameSign = "";
+ } else {
+ // For backward compatibility - default
+ // Or explicitly enabled
+ quoteFileNameSign = "\"";
+ }
+
+ String contentDisposition = String.format("Attachment; filename=%s%s%s", quoteFileNameSign, msg.getAttribute(FileAttribute.MA_FILENAME), quoteFileNameSign);
mimeBodyPart.setHeader("Content-Disposition", contentDisposition);
msg.setContentDisposition(contentDisposition);
}
diff --git a/Server/src/test/java/org/openas2/processor/receiver/ContentDispositionTest.java b/Server/src/test/java/org/openas2/processor/receiver/ContentDispositionTest.java
new file mode 100644
index 00000000..b4ec48f3
--- /dev/null
+++ b/Server/src/test/java/org/openas2/processor/receiver/ContentDispositionTest.java
@@ -0,0 +1,73 @@
+package org.openas2.processor.receiver;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import jakarta.mail.internet.MimeBodyPart;
+
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.TestInstance.Lifecycle;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.openas2.OpenAS2Exception;
+import org.openas2.app.BaseServerSetup;
+import org.openas2.message.FileAttribute;
+import org.openas2.partner.Partnership;
+
+@TestInstance(Lifecycle.PER_CLASS)
+@TestMethodOrder(MethodOrderer.MethodName.class)
+public class ContentDispositionTest extends BaseServerSetup {
+ private DirectoryPollingModule poller;
+
+ @BeforeAll
+ public void setUp() throws Exception {
+ super.createFileSystemResources();
+ super.setup();
+ this.poller = session.getPartnershipPoller(simpleTestMsg.getPartnership().getName());
+ }
+
+ @AfterAll
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void shouldUseSettingFromPartnership() throws Exception {
+
+ // Set the partnership to disable quotes for the filename
+ assertThat(getContentDispositionForQuoteConfiguration("false"), is("Attachment; filename=filename.ext"));
+ assertThat(getContentDispositionForQuoteConfiguration("FALSE"), is("Attachment; filename=filename.ext"));
+ assertThat(getContentDispositionForQuoteConfiguration("False"), is("Attachment; filename=filename.ext"));
+
+ // Set the partnership to enable quotes for the filename
+ assertThat(getContentDispositionForQuoteConfiguration("true"), is("Attachment; filename=\"filename.ext\""));
+ assertThat(getContentDispositionForQuoteConfiguration("TRUE"), is("Attachment; filename=\"filename.ext\""));
+ assertThat(getContentDispositionForQuoteConfiguration("tRuE"), is("Attachment; filename=\"filename.ext\""));
+ }
+
+ @Test
+ public void shouldUseDefaultSetting() throws Exception {
+
+ //Check backward compatible configuration
+ assertThat(getContentDispositionForQuoteConfiguration(""), is("Attachment; filename=\"filename.ext\""));
+ assertThat(getContentDispositionForQuoteConfiguration(null), is("Attachment; filename=\"filename.ext\""));
+ assertThat(getContentDispositionForQuoteConfiguration("other"), is("Attachment; filename=\"filename.ext\""));
+ }
+
+ private String getContentDispositionForQuoteConfiguration(String valueOfQuoteSendFileName) throws OpenAS2Exception {
+
+ if (valueOfQuoteSendFileName != null) {
+ simpleTestMsg.getPartnership().setAttribute(Partnership.PA_QUOTE_SEND_FILE_NAME, valueOfQuoteSendFileName);
+ }
+
+ simpleTestMsg.setAttribute(FileAttribute.MA_FILENAME, "filename.ext");
+ this.poller.setAdditionalMetaData(simpleTestMsg, new MimeBodyPart());
+
+ return simpleTestMsg.getContentDisposition();
+ }
+
+
+}
diff --git a/changes.txt b/changes.txt
index d7a49139..1d373287 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,5 +1,31 @@
**IMPORTANT NOTE**: Please review upgrade notes in the RELEASE-NOTES.md if you are upgrading
+Version 4.7.2 - 2025-10-23
+
+This is a minor enhancement release.
+1. Changes to partnership.xml
+
+ * New optional attribute `quote_send_file_name` for the partnership to specify if
+ the filename which is to be included in header `Content-Disposition: Attachment; filename="filename.ext"` should be quoted or not.
+ Useful for target AS2 servers which are picky about the quotes. Requires `sendfilename="true"` to be set.
+
+ Any value other than "false" will be considered true - default: true (previous behaviour).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Version 4.7.1 - 2025-10-20
This is a minor enhancement release.