Fix sending multiple files shared from other apps or picked via the system picker
Ric committed
- Author
- Ric · 61457974+dallo28@users.noreply.github.comOct 19, 2026 at 17:02
- Committer
- Ric · 61457974+dallo28@users.noreply.github.comOct 19, 2026 at 17:02
- Parents
- f32ffeec763f
Fix sending multiple files shared from other apps or picked via the system picker Two related problems when sending several documents at once: - ACTION_SEND_MULTIPLE resolved each shared content:// uri to a raw file path via AndroidUtilities.getPath() and uploaded from that path. Under scoped storage Telegram usually can't open such paths (e.g. files in Download/ shared from a file manager), so every upload failed with EACCES and the grouped message got stuck with a red error mark. With scoped storage the shared files are now copied into the cache with MediaController.copyFileToCache(), exactly as the single-file ACTION_SEND path already does. - Files picked in the system document picker (attach > File > Internal Storage, requestCode 21) were sent one by one through sendUriAsDocument(), so each ended up as a separate message instead of an album. All picked files are now passed to a single prepareSendingDocuments() call, which groups them like other multi-document sends. When editing a message's media, the previous behavior is kept: the first file replaces the media and the others are sent as new messages. Since the picker now groups its files, also fix prepareSendingDocuments() for a group whose closing file fails (empty file, too large, copy error): the group was never marked final, so the files already queued in it were uploaded but never sent. The group is now closed with the queued files. Fixes https://bugs.telegram.org/c/66155
3 files changed+92−37