Opening attachment in Nextcloud Office builds malformed DAV path
@kesselb is already working on this.
Since Jun 2, 2026.
- 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)
- Open a message with a PDF (or other Viewer-handled) attachment.
- Click the attachment to preview it; Viewer hands off to Nextcloud Office (richdocuments).
- 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:
sourceandfilenameare set toattachment.downloadUrl, which is an absolute URL produced byIURLGenerator::linkToRouteAbsolute()in
lib/Service/Attachment/AttachmentService.php:318andlib/Controller/MessagesController.php:1075.fileidis 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.