Skip to content

Opening attachment in Nextcloud Office builds malformed DAV path #12988

@Karamelmar

Description

@Karamelmar

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)

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions