Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReceiveExternalFilesActivity intent #12406

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -850,16 +850,16 @@ private String generatePath(Stack<String> 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);
}
}

Expand Down
Loading