From c146c03f5d9b2598ca355ecdd76d36ec7d3de905 Mon Sep 17 00:00:00 2001 From: Krainov Gleb Date: Mon, 12 Oct 2026 08:36:10 +0000 Subject: [PATCH] fix(sharing): download file before "Send copy to" "Send copy to" put the exposed file URI into the send intent without checking whether the file is stored on the device. For a file that was never downloaded getExposedFileUri() returns null, so the receiving app gets ACTION_SEND without EXTRA_STREAM and cannot send anything. A file that is not on the device now goes through SendShareDialog, which already downloads the file (DOWNLOAD_SEND) and sends it afterwards, like the "Send/share" menu entry of the details screen. Downloaded files keep using the system chooser. The download path is taken only when the host activity implements SendShareDialogDownloader, because ShareActivity hosts the sharing fragment too and would close the dialog without sending. Refs: #17619 Signed-off-by: Krainov Gleb Assisted-by: Claude-Code:claude-opus-5-5 --- .../android/ui/fragment/FileDetailSharingFragment.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.kt b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.kt index 465948398000..68729c4aadf3 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.kt +++ b/app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.kt @@ -67,6 +67,7 @@ import com.owncloud.android.ui.activity.FileActivity import com.owncloud.android.ui.adapter.ShareeListAdapter import com.owncloud.android.ui.adapter.ShareeListAdapterListener import com.owncloud.android.ui.asynctasks.RetrieveHoverCardAsyncTask +import com.owncloud.android.ui.dialog.SendShareDialog import com.owncloud.android.ui.dialog.SharePasswordDialogFragment import com.owncloud.android.ui.dialog.SharePasswordDialogFragment.Companion.newInstance import com.owncloud.android.ui.fragment.QuickSharingPermissionsBottomSheetDialog.QuickPermissionSharingBottomSheetActions @@ -344,9 +345,15 @@ class FileDetailSharingFragment : } sendCopyBtn.setOnClickListener { + val file = file ?: return@setOnClickListener + if (!file.isDown && activity is SendShareDialog.SendShareDialogDownloader) { + fileOperationsHelper?.sendShareFile(file, true) + return@setOnClickListener + } + startActivity( Intent.createChooser( - IntentUtil.createSendIntent(requireContext(), file!!), + IntentUtil.createSendIntent(requireContext(), file), requireContext().getString(R.string.activity_chooser_send_file_title) ) )