nextcloud / nextcloud/mail

Opening attachment in Nextcloud Office builds malformed DAV path

Open
#12,988 2 comments 0 reactions 1 assignee View on GitHub

@kesselb is already working on this.

Since Jun 2, 2026.

0. to triage bug
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
Steps to reproduce

Req.: richdocuments must be enabled (Nextcloud Office with collabora Code in my setup)

  1. Open a message with a PDF (or other Viewer-handled) attachment.
  2. Click the attachment to preview it; Viewer hands off to Nextcloud Office (richdocuments).
  3. Request fails with "Failed to generate token for file".
Server log shows

PROPFIND /remote.php/dav/files/https%3A//cloud.example.com/apps/mail/api/messages/188882/attachment/2/
The username and the attachment's absolute download URL are concatenated with no separator → first path segment parsed as principal <user>https: → "Principal not
found".

Probable Root cause ??

src/mixins/AttachementMixin.js lines 8–18 build a fileInfo for OCA.Viewer.open() where:

  • source and filename are set to attachment.downloadUrl, which is an absolute URL produced by IURLGenerator::linkToRouteAbsolute() in
    lib/Service/Attachment/AttachmentService.php:318 and lib/Controller/MessagesController.php:1075.
  • fileid is set to the (non-DAV) attachment id.

Viewer + richdocuments then construct a DAV URL roughly as /remote.php/dav/files/${uid}${source}, producing the malformed path above. Mail attachments are not real
files under the user root, so handing them to richdocuments cannot succeed.

Expected behavior

PDF/image/video attachments preview inline via Viewer's built-in handlers (plain GET on source); richdocuments is not invoked for mail attachments.

Actual behavior

opens a Window which says "Loading 2 ...", but it never loads.

Mail app version

5.8.1

Nextcloud version

33.0.3

Mailserver or service

Dovecot

Operating system

Arch

PHP engine version

None

Nextcloud memory caching

Redis

Web server

Nginx

Database

MariaDB

Additional info
  • Collabora Online: 25.04.9.4
  • Browser: any (reproducible in Chromium and Firefox)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.