Skip to content

Preview is active on file sidebar even if preview is set false on config.php #6764

@rogerfv1

Description

@rogerfv1

Steps to reproduce

  1. Set 'enable_previews' => false on config.php.
  2. Create a 'new text file' (ex: preview.txt).
  3. Click on 'Details' of that file.

Expected behaviour

The preview should not be shown on details sidebar.

Actual behaviour

The preview is showed on details sidebar.

Server configuration

Operating system: Debian 8

Web server: Apache 2.4

Database: Postgresql 9.4

PHP version: php 5.6

Nextcloud version: 12.0.3

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP

We looked at the source code to see if we found the function that defines the preview load.
So we find a javascript function named loadPreview but it seems that this function is not considering the enable_previews set on config.php.

File: /var/www/nextcloud/apps/files/js/sidebarpreviewmanager.js

"...
loadPreview: function (model, $thumbnailDiv, $thumbnailContainer) {
if (model.get('hasPreview') === false && this.getMimeTypePreviewHandler(model.get('mimetype')) === null) {

...
"

In this case when getMimeTypePreviewHandler = 'native code' the preview is showed even you set enable_previews to false on config.php.

These are the results we got in our tests.

enable_previews (config.php) MimeType hasPreview getMimeTypePreviewHandler Preview is showed?(actual behaviour) Preview is showed? (expected behaviour)
true text/plain true native code yes yes
true image/png true null yes yes
true text/csv false native code yes yes
true application/pdf false native code yes yes
false text/plain false native code yes no
false image/png false null false yes
false text/csv false native code yes no
false application/pdf false native code yes no

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