Skip to content

fix(ui): save the attachment of its own message in a thread - #14007

Open
dillardblom wants to merge 1 commit into
nextcloud:mainfrom
dillardblom:fix/attachment-save-own-message
Open

dillardblom wants to merge 1 commit into
nextcloud:mainfrom
dillardblom:fix/attachment-save-own-message

Conversation

@dillardblom

Copy link
Copy Markdown
Contributor

Summary

"Save to Files" on a single attachment saved the wrong file when the attachment belongs to another message of the open thread. MessageAttachment took the message id from the route ($route.params.threadId), which is the selected message of the thread, and combined it with its own attachment id. Attachment ids are MIME part numbers, so they repeat across messages: the selected message's part with the same number was saved instead.

MessageAttachments now passes the id of the message the attachment belongs to (envelope.databaseId, as "Save all" and "Download Zip" already do) and saveToCloud uses it.

How to reproduce

  1. Thread of two messages: message 1 with a PDF, message 2 (a reply) with an attached message (.eml). Both attachments are part 2.
  2. Open the thread from message 2 in the list, so the route is …/thread/<id of message 2>.
  3. On the PDF of message 1, choose "Save to Files".

Before: Embedded message.eml is saved instead of the PDF. After: the PDF is saved.

Reproduced on 5.12.6; the same code is on main and stable5.13. On stable5.12, "Save all" also uses the route id; that part is already fixed on main and stable5.13.

Test plan

  • New MessageAttachment.vue.spec.js: saving uses the attachment's own message id, not the route's. Fails without the fix, passes with it.
  • Full unit suite: 62 files, 518 tests pass.
  • On a 5.12.6 instance with a thread as above: the request the UI sends (POST /api/messages/<message 2>/attachment/2) saves the .eml; with the attachment's own message id it saves the PDF.

/backport to stable5.13
/backport to stable5.12

"Save to Files" on a single attachment used the message id from the route,
which in a thread is the selected message, not necessarily the message the
attachment belongs to. It then saved the attachment with the same id of the
selected message, for example an embedded message instead of a PDF.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>
dillardblom added a commit to dillardblom/nextcloud-mail that referenced this pull request Nov 1, 2026
Signed-off-by: Dillard Blom <dillard.blom@ensembia.com>

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant