-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Steps to reproduce
- Set 'enable_previews' => false on config.php.
- Create a 'new text file' (ex: preview.txt).
- 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 |