Skip to content

fix: Prevent starting the same file download twice - #2699

Merged
SystemKeeper merged 1 commit into
mainfrom
fix/2694/dedupe-file-downloads
Sep 8, 2026
Merged

fix: Prevent starting the same file download twice#2699
SystemKeeper merged 1 commit into
mainfrom
fix/2694/dedupe-file-downloads

Conversation

@Ivansss

@Ivansss Ivansss commented Sep 7, 2026

Copy link
Copy Markdown
Member

Fixes #2694

  • The fileParameter.fileStatus?.isDownloading guards in the chat could never be true since feat: Improve file downloading handling聽#2598, so every tap started another download of the same file. Chat downloads now go through ChatFileDownloader, which already shared one download between callers asking for the same file.
  • NCChatFileController reports through a completion handler instead of a delegate, so the caller's intent stays at the call site. This removes messageType and actionType, which only existed to tell the callbacks apart again.
  • The completion handler is now called exactly once on every path, including cancellation. Before, cancelling dropped the handler, which would have left ChatFileDownloader with an entry it never cleans up, blocking that file for the rest of the session.
  • Renamed NCChatFileControllerWrapper to ChatFileDownloader: it no longer wraps a delegate, and the name now matches ChatFileUploader.
  • Removed the dead fileStatus branch in BaseChatTableViewCell+File.

Not changed here: the media viewer keeps its own NCChatFileController because it needs to cancel downloads for pages the user swiped past, and ChatFileDownloader deliberately has no cancellation. Repeated requests for the same file still queue one handler each, as before.

How to test

  1. Tap a PDF in a conversation repeatedly while it downloads -> only one download runs.
  2. Play a voice message, transcribe one, open an image and a video, open a file from Shared items, open the file of a file conversation -> all still work.
  3. Swipe quickly through several images in the media viewer -> downloads of skipped pages are still cancelled.

馃 AI (if applicable)

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

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
@Ivansss
Ivansss requested a review from SystemKeeper September 7, 2026 09:05
@SystemKeeper
SystemKeeper merged commit 8ab1030 into main Sep 8, 2026
10 checks passed
@SystemKeeper
SystemKeeper deleted the fix/2694/dedupe-file-downloads branch September 8, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repeated taps can start the same download twice since fileStatus is no longer set on the message

2 participants