Commits

Asankha Perera  committed d6b0b53

set attachment content type (mainly for AS2) based on file name extension

  • Participants
  • Parent commits b490cbe

Comments (0)

Files changed (1)

File modules/api/src/main/java/org/adroitlogic/as2/api/AttachmentDetails.java

     public AttachmentDetails(MessageFile messageFile, String contentType) {
         this.messageFile = messageFile;
         this.fileName = messageFile.getAbsolutePath();
-        this.contentType = contentType;
+        if (fileName.toLowerCase().endsWith(".xml")) {
+            this.contentType = "application/xml";
+        } else {
+            this.contentType = contentType;
+        }
         this.contentTransferEncoding = null;
         this.textContent = null;
         this.isText = false;
     public AttachmentDetails(String fileName, String contentType) {
         this.messageFile = null;
         this.fileName = fileName;
-        this.contentType = contentType;
+        if (fileName.toLowerCase().endsWith(".xml")) {
+            this.contentType = "application/xml";
+        } else {
+            this.contentType = contentType;
+        }
         this.contentTransferEncoding = null;
         this.textContent = null;
         this.isText = false;