Skip to content

DocumentsProvider does not expose thumbnails for PDF and video files in Android SAF file picker. #17521

Description

@AlexandreDuarteCWB

⚠️ Before posting ⚠️

  • This is a bug, not a question or an enhancement.
  • I've searched for similar issues and didn't find a duplicate.
  • I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
  • I agree to follow Nextcloud's Code of Conduct.

Steps to reproduce

  1. Configure a Nextcloud account in the Nextcloud Android app;
  2. Have JPEG, PDF and MP4 files stored in Nextcloud;
  3. From another Android application, open the Android system file picker using the Storage Access Framework;
  4. Select Nextcloud as the document provider;
  5. Navigate to a folder containing these file types;
  6. Observe that JPEG files can display thumbnails, while PDF and MP4 files are shown only with generic file-type icons;
  7. Open the same files directly in the Nextcloud Android app and observe that previews are available there.

Expected behaviour

PDF and video files should expose thumbnail support through the Nextcloud Android DocumentsProvider when a preview is available or can be generated, allowing Android's system file picker to display thumbnails in the same way it does for image files.

Actual behaviour

When Nextcloud is accessed through Android's system file picker, JPEG files can display thumbnails, but PDF and MP4 files are shown only with generic file-type icons.

The same PDF and MP4 files display previews correctly when viewed directly inside the Nextcloud Android app.

I also reproduced the behavior while monitoring the Nextcloud DocumentsProvider with ADB. openDocumentThumbnail() is called for JPEG files, but no corresponding thumbnail requests are observed for PDF or MP4 files.

This suggests that thumbnail support is not being exposed to Android SAF for these file types.

Android version

16

Device brand and model

Samsung Galaxy S24 FE

Stock or custom OS?

Stock

Nextcloud android app version

34.1.0

Nextcloud server version

33.0.5

Using a reverse proxy?

I don't know

Android logs

ADB investigation:

For JPEG files, Android requests thumbnails from the Nextcloud DocumentsProvider:

DocumentsStorageProvider: openDocumentThumbnail(), id=

The provider then attempts to access a cached JPEG thumbnail:

DiskLruImageCacheFileProvider: Error opening file:
/data/user/0/com.nextcloud.client/cache/.jpg

When folders containing PDF and MP4 files are displayed, no corresponding
openDocumentThumbnail() calls are observed for those files.

All account names, server addresses, filenames and document IDs have been
redacted.

Server error logs

Additional information

The same PDF and MP4 files have working previews inside the Nextcloud Android app. The issue appears only when Nextcloud is accessed as a document provider through Android's Storage Access Framework.

ADB testing showed that openDocumentThumbnail() is requested for JPEG files, while no equivalent request is made for PDF or MP4 files.

This may indicate that thumbnail capability is not being advertised to Android for PDF and video document types.

Possibly related, but not identical:

#1827 — Thumbnails don't show when NC used as a document provider
#14863 — Incorrect Default Thumbnail for PDF Files

No full logs are attached because they contain account names, server addresses, filenames and document identifiers. Relevant log excerpts were manually redacted above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions