Merge branch 'fix_openOutputStream' into 'master'

Fix usage of ContentResolver.openOutputStream()

See merge request briar/briar!1607
This commit is contained in:
akwizgran
2022-04-01 12:36:50 +00:00
2 changed files with 4 additions and 3 deletions

View File

@@ -39,6 +39,6 @@ class AndroidRemovableDrivePlugin extends RemovableDrivePlugin {
OutputStream openOutputStream(TransportProperties p) throws IOException { OutputStream openOutputStream(TransportProperties p) throws IOException {
String uri = p.get(PROP_URI); String uri = p.get(PROP_URI);
if (isNullOrEmpty(uri)) throw new IllegalArgumentException(); if (isNullOrEmpty(uri)) throw new IllegalArgumentException();
return app.getContentResolver().openOutputStream(Uri.parse(uri)); return app.getContentResolver().openOutputStream(Uri.parse(uri), "wt");
} }
} }

View File

@@ -1,6 +1,7 @@
package org.briarproject.briar.android.conversation; package org.briarproject.briar.android.conversation;
import android.app.Application; import android.app.Application;
import android.content.ContentResolver;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.view.View; import android.view.View;
@@ -249,8 +250,8 @@ public class ImageViewModel extends DbViewModel implements EventListener {
} }
private OutputStream getOutputStream(Uri uri) throws IOException { private OutputStream getOutputStream(Uri uri) throws IOException {
OutputStream os = ContentResolver contentResolver = getApplication().getContentResolver();
getApplication().getContentResolver().openOutputStream(uri); OutputStream os = contentResolver.openOutputStream(uri, "wt");
if (os == null) throw new IOException(); if (os == null) throw new IOException();
return os; return os;
} }