From 995600ec2ca6e43f0c5aff8a8f60b82cbc5940f8 Mon Sep 17 00:00:00 2001 From: ZetaTom <70907959+ZetaTom@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:39:01 +0100 Subject: [PATCH] Fix ReceiveExternalFilesActivity intent Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com> --- .../ui/activity/ReceiveExternalFilesActivity.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java index 6d0b6983f870..90ff8ab92cd7 100755 --- a/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ReceiveExternalFilesActivity.java @@ -174,8 +174,6 @@ public class ReceiveExternalFilesActivity extends FileActivity @Override protected void onCreate(Bundle savedInstanceState) { - prepareStreamsToUpload(); - if (savedInstanceState != null) { String parentPath = savedInstanceState.getString(KEY_PARENTS); @@ -191,6 +189,8 @@ protected void onCreate(Bundle savedInstanceState) { binding = ReceiveExternalFilesBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); + prepareStreamsToUpload(); + // Listen for sync messages IntentFilter syncIntentFilter = new IntentFilter(RefreshFolderOperation. EVENT_SINGLE_FOLDER_CONTENTS_SYNCED); @@ -850,16 +850,16 @@ private String generatePath(Stack dirs) { private void prepareStreamsToUpload() { Intent intent = getIntent(); - if (Intent.ACTION_SEND.equals(intent.getAction())) { + if (intent.hasExtra(Intent.EXTRA_STREAM) && Intent.ACTION_SEND.equals(intent.getAction())) { mStreamsToUpload = new ArrayList<>(); mStreamsToUpload.add(IntentExtensionsKt.getParcelableArgument(intent, Intent.EXTRA_STREAM, Parcelable.class)); - } else if (Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) { + } else if (intent.hasExtra(Intent.EXTRA_STREAM) && Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) { mStreamsToUpload = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); - } - - if (mStreamsToUpload == null || mStreamsToUpload.isEmpty() || mStreamsToUpload.get(0) == null) { + } else if (intent.hasExtra(Intent.EXTRA_TEXT) && Intent.ACTION_SEND.equals(intent.getAction())) { mStreamsToUpload = null; saveTextsFromIntent(intent); + } else { + showErrorDialog(R.string.uploader_error_message_no_file_to_upload, R.string.uploader_error_title_file_cannot_be_uploaded); } }