Skip to content

fix(sharing): download file before "Send copy to" - #17807

Open
ToteMeiSter wants to merge 1 commit into
nextcloud:masterfrom
ToteMeiSter:fix/send-copy-not-downloaded-file
Open

ToteMeiSter wants to merge 1 commit into
nextcloud:masterfrom
ToteMeiSter:fix/send-copy-not-downloaded-file

Conversation

@ToteMeiSter

@ToteMeiSter ToteMeiSter commented Oct 12, 2026 •

Copy link
Copy Markdown

Problem

Closes #17619

The "Send copy to" button on the sharing tab of the file details builds the send intent with OCFile.getExposedFileUri(). That method returns null when the file has no local copy. The sharing tab can be opened for a file that was never downloaded, so Telegram, WhatsApp and other apps receive ACTION_SEND without EXTRA_STREAM and show "Unsupported content" or send nothing. For a file that is already on the device the button works.

The button was added in #16183 without a download step. The previous share entry went through SendShareDialog, which downloads the file first.

Change

FileDetailSharingFragment: when the file is not on the device, the button calls FileOperationsHelper.sendShareFile(file, true). This is the same call the "Send/share" menu entry of the details screen uses. SendShareDialog lists the apps, downloads the file through the host's SendShareDialogDownloader (FileDisplayActivity, DOWNLOAD_SEND) and sends it to the chosen app. A downloaded file still opens the system chooser. The download path is used only when the host activity implements SendShareDialogDownloader; ShareActivity also hosts the fragment and does not implement it, so it keeps the old behaviour.

Notes

How to test

  • Unit: no new test. The existing unit tests pass (jacocoTestGplayDebugUnitTest).
  • Device: Checked on a HUAWEI Mate X7 (DEL-LX9, EMUI 15.0.0, Android 12) with a test build: works, "Send copy to" for a file that was not downloaded downloads it and sends it.
  • Manual steps:
    1. Open the details of a file that is not downloaded, go to the sharing tab.
    2. Tap "Send copy to", pick an app.
    3. The file is downloaded and sent to the app.
    4. Repeat with a downloaded file: the system chooser opens as before.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The change was drafted with Claude Code (Assisted-by: Claude-Code:claude-opus-5-5).

"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: nextcloud#17619
Signed-off-by: Krainov Gleb <krajnov.g@kontentplus.ru>
Assisted-by: Claude-Code:claude-opus-5-5
@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...d/android/ui/fragment/FileDetailSharingFragment.kt 0.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sharing with send copy to doesn't work

1 participant