android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java | 16 ++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
New commits: commit f0a3e28a67cd7f44f10fb792b04dcd40a43f26e2 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Fri Jul 3 22:38:23 2020 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Wed Jul 15 23:43:27 2020 +0200 android: Fallback to "w" mode, "wt" is not supported by Google Drive. Would be cool to consolidate these two places actually to a common method at some stage... Change-Id: I5ff3aed134066f26bb058223b972ef11600fa887 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97912 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java index 3ea256a0a..6111fc700 100644 --- a/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java +++ b/android/lib/src/main/java/org/libreoffice/androidlib/LOActivity.java @@ -483,7 +483,13 @@ public class LOActivity extends AppCompatActivity { inputStream = new FileInputStream(mTempFile); Uri uri = getIntent().getData(); - outputStream = contentResolver.openOutputStream(uri, "wt"); + try { + outputStream = contentResolver.openOutputStream(uri, "wt"); + } + catch (FileNotFoundException e) { + Log.i(TAG, "failed with the 'wt' mode, trying without: " + e.getMessage()); + outputStream = contentResolver.openOutputStream(uri); + } byte[] buffer = new byte[1024]; int length; @@ -583,7 +589,13 @@ public class LOActivity extends AppCompatActivity { LOActivity.this.saveAs(tempFile.toURI().toString(), format); inputStream = new FileInputStream(tempFile); - outputStream = getContentResolver().openOutputStream(intent.getData(), "wt"); + try { + outputStream = getContentResolver().openOutputStream(intent.getData(), "wt"); + } + catch (FileNotFoundException e) { + Log.i(TAG, "failed with the 'wt' mode, trying without: " + e.getMessage()); + outputStream = getContentResolver().openOutputStream(intent.getData()); + } byte[] buffer = new byte[4096]; int len; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits