@@ -612,7 +612,15 @@ else if (attachment.containsKey("content-type")) {
612612 " issue #80): %s" , attachment );
613613 }
614614
615- FileBody fileBody = new FileBody (file , contentType );
615+ // NOTE: Content-Encoding might not be necessary to set. Apache FileBody does not set Content-Encoding.
616+ // FileBody always return null for getContentEncoding(), and Content-Encoding header is not set in multipart
617+ // CBL iOS: https://github.com/couchbase/couchbase-lite-ios/blob/feb7ff5eda1e80bd00e5eb19f1d46c793f7a1951/Source/CBL_Pusher.m#L449-L452
618+ String contentEncoding = null ;
619+ if (attachment .containsKey ("encoding" )){
620+ contentEncoding = (String )attachment .get ("encoding" );
621+ }
622+
623+ FileBody fileBody = new CustomFileBody (file , contentType , contentEncoding );
616624 multiPart .addPart (attachmentKey , fileBody );
617625 }
618626
@@ -714,4 +722,19 @@ private static int findCommonAncestor(RevisionInternal rev, List<String> possibl
714722
715723 return generation ;
716724 }
725+
726+ // CustomFileBody to support contentEncoding. FileBody returns always null for getContentEncoding()
727+ private static class CustomFileBody extends FileBody {
728+ private String contentEncoding = null ;
729+
730+ public CustomFileBody (final File file , final String mimeType , final String contentEncoding ) {
731+ super (file , mimeType );
732+ this .contentEncoding = contentEncoding ;
733+ }
734+
735+ @ Override
736+ public String getContentEncoding () {
737+ return contentEncoding ;
738+ }
739+ }
717740}
0 commit comments