Repository navigation
fix(sharing): download file before "Send copy to" - #17807
ToteMeiSter wants to merge 1 commit into
Conversation
"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 Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
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 returnsnullwhen 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 receiveACTION_SENDwithoutEXTRA_STREAMand 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 callsFileOperationsHelper.sendShareFile(file, true). This is the same call the "Send/share" menu entry of the details screen uses.SendShareDialoglists the apps, downloads the file through the host'sSendShareDialogDownloader(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 implementsSendShareDialogDownloader;ShareActivityalso hosts the fragment and does not implement it, so it keeps the old behaviour.Notes
SendShareDialog. "Send copy to" was the only one that calledIntentUtil.createSendIntentdirectly.SendShareDialog/SendShareDialogDownloaderpath is reused. The host of the sharing tab,FileDisplayActivity, already implementsSendShareDialogDownloader.SendShareDialogsends a not downloaded image as the cached preview (sendCachedImage), not as the original. The menu entry behaves the same way today. Changing that is out of scope here.FileDetailSharingFragment. No file overlap with the other three PRs (fix(auto-upload): restart folder runs that stay enqueued on rescan #17805, fix(auto-upload): start auto upload right after resuming global upload pause #17806, fix(share): send original file instead of cached thumbnail #17808); trial merge of all four is clean. Logically it goes together with fix(share): send original file instead of cached thumbnail #17808 (SendShareDialog): with both merged, a not downloaded picture from "Send copy to" is downloaded and sent as the original.How to test
jacocoTestGplayDebugUnitTest).🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)
The change was drafted with Claude Code (
Assisted-by: Claude-Code:claude-opus-5-5).