nextcloud / nextcloud/richdocuments

Watermark BeforeFetchPreviewListener returns 404 for png and jpg in Files

Open
#2,828 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug feature: previews and thumbnails feature: secure view
Dominant language
JavaScript
Stars
453
Forks
147
Avg merge
14h 54m
Merged PRs (30d)
83

Description

Describe the bug
When Watermark is enabled in Richdocuments, then I cannot get a preview anymore for png and jpg files, but get a 404 error.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Watermark in Nextcloud Office settings in Administration
  2. In Files, click on a PNG picture, to see the preview.
  3. You get a 404 error

Expected behavior
I would only expect this to affect documents managed by Richdocuments, eg. Text, Spreadsheet, etc, but not png and jpg files.
It says on the admin screen: "The settings only apply to compatible office files that are opened in Nextcloud Office"

The preview fails with 404, because of https://github.com/nextcloud/richdocuments/blob/main/lib/Listener/BeforeFetchPreviewListener.php#L80
I suggest to only throw a NotFoundException if the document is an office document.

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.

Research direction

Start with lib/Listener/BeforeFetchPreviewListener.php around line 80 and review how the listener handles PNG and JPG previews versus office documents. Verify that previews for image files no longer return 404 while the watermark behavior remains limited to compatible office files.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.