@@ -165,7 +165,7 @@ public void run() {
165165 if (options .addAndroidDownloads .getBoolean ("useDownloadManager" )) {
166166 Uri uri = Uri .parse (url );
167167 DownloadManager .Request req = new DownloadManager .Request (uri );
168- if (options .addAndroidDownloads .getBoolean ("notification" )) {
168+ if (options .addAndroidDownloads .hasKey ( "notification" ) && options . addAndroidDownloads . getBoolean ("notification" )) {
169169 req .setNotificationVisibility (DownloadManager .Request .VISIBILITY_VISIBLE_NOTIFY_COMPLETED );
170170 } else {
171171 req .setNotificationVisibility (DownloadManager .Request .VISIBILITY_HIDDEN );
@@ -562,11 +562,13 @@ private void done(Response resp) {
562562 String utf8 = new String (b );
563563 callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_UTF8 , utf8 );
564564 }
565- // This usually mean the data is contains invalid unicode characters, it's
566- // binary data
565+ // This usually mean the data is contains invalid unicode characters but still valid data,
566+ // it's binary data, so send it as a normal string
567567 catch (CharacterCodingException ignored ) {
568+
568569 if (responseFormat == ResponseFormat .UTF8 ) {
569- callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_UTF8 , "" );
570+ String utf8 = new String (b );
571+ callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_UTF8 , utf8 );
570572 }
571573 else {
572574 callback .invoke (null , RNFetchBlobConst .RNFB_RESPONSE_BASE64 , android .util .Base64 .encodeToString (b , Base64 .NO_WRAP ));
0 commit comments