Gallery / Galleryplus slideshow not working

Hi everyone,

I am using Nextcloud 9.0.53 and Galleryplus 15.1.1. If I remember correcty the behaviour when clicking on an image was to display it in some kind of slideshow. Instead of this the browser tries to download the file (tested with latest Firefox and Chrome)

Within the browser console I noticed a Content-Security-Policy error: Content Security Policy: Die Einstellungen der Seite haben das Laden einer Ressource auf self blockiert (“script-src https://example.org ‘unsafe-eval’”). (Sorry for the german message, it means that loading of a resource was blocked because of CSP.) After adding unsafe-inline to the CSP script-src header the error doesn’t appear anymore but the slideshow isn’t working also (so I changed the CSP back to the default)

I don’t know how long this error affects me but I think it persits already for a long time and after searching through the forums and GitHub issues I could not find any solution.

I am thankful for any advise you give me.

Best Regard,
Finn Christiansen

EDIT: Of course I had a look in the owncloud.log but not a single line is logged while clicking on an image or browsing through the images.

@LukasReschke

@oparoz might also know this.

Probably unrelated to any CSP policy.
I suspect a conflict with another app.

I have heard of problems with files_mv but I am not using this app. For completeness here is the output of occ app:list:

Enabled:
  - activity: 2.2.1
  - admin_audit: 1.0.0
  - calendar: 1.3.2
  - comments: 0.2
  - contacts: 1.3.1.0
  - dav: 0.1.6
  - federatedfilesharing: 0.1.0
  - federation: 0.0.4
  - files: 1.4.4
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.9.1
  - files_texteditor: 2.1
  - files_trashbin: 0.8.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - galleryplus: 15.1.1
  - notifications: 0.2.3
  - password_policy: 1.0.0
  - provisioning_api: 0.4.1
  - systemtags: 0.2
  - templateeditor: 0.1
  - theming: 0.1.0
  - updatenotification: 0.1.0
Disabled:
  - encryption
  - external
  - files_external
  - files_versions
  - gallery
  - user_external
  - user_ldap
  - user_saml

Thanks. There is nothing obvious in this list.
Is Nextcloud installed in a folder?

What do you mean by “installed in a folder”?

I have installed it on a Debian Jessie server using the tar.bz2 archive an it is located in /var/www/vhosts/owncloud.example.org if this matters. The data directory is located at /opt/owncloud.

Thanks. That’s what I wanted to know.
So your URL is https://nextcloud.example.org and not https://example.org/nextcloud

I’m trying to figure out why the script isn’t loaded on the Files side.

Now I got it… yes, my URL is https://nextcloud.example.org

The only advice I can offer at the moment is to disable other apps one by one, starting with Contacts, Calendar and the video player until you find the one which gets in the way.

Does the original Gallery work?

Thanks for the hint but this doesn’t solve the problem. The only enabled apps left were:

php occ app:list
Enabled:
  - dav: 0.1.6
  - federatedfilesharing: 0.1.0
  - files: 1.4.4
  - galleryplus: 15.1.1

After disabling the apps I cleared my browser cache. I don’t use asset pipelinging so I think this should be enough, right?)

UPDATE: I have just noticed one thing: The slideshow works but only if I view images via a shared link. Is this the expected behaviour? If I remember correctly I also could use the slideshow while viewing my own files/images.

You should be able to see local files as well. Maybe some preview types have not been enabled?
And is this only happening on the Files side or is the slideshow also broken in Gallery itself?

Another explanation could be that the media type of some of your files is wrong and repairing the filecache may help.

After using the defaults for the most time I added these lines to the config.php:

  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    11 => 'OC\\Preview\\Illustrator',
    12 => 'OC\\Preview\\Postscript',
    13 => 'OC\\Preview\\Photoshop',
    14 => 'OC\\Preview\\TIFF',
  ),

Repairing the file cache didn’t change a thing also:

php occ files:cleanup
0 orphaned file cache entries deleted

It seems like the galleryplus app only works via shared links. The grid view is also broken when I browse through my own files (the circle keeps spinning).

I think you might have a PHP memory limit set too low.

The memory limit was set to 512M (which should be enough I think) and raising it to 1024 MB did not make any difference.
I think I should try with a clean nextcloud installation on a testing server and see if the galleryplus apps works. If it works, which I think it should, I hopefully will find something which differs from my instalation.
Thank you for your help so far.

Yeah, 512MB is enough. I thought that maybe the shared pictures were smaller than the ones you have locally.
And thinking about it, you would have seen something in the logs.

A browser extension would also leave a trace in the browser logs, so I’m not sure what’s happening here.

After also trying with the latest version of nextcloud and the default gallery app I found the reason for the “broken” gallery / slideshow view.

While being logged in I see this request:

/apps/gallery/config?extramediatypes=1 

This request is redirected and a trailing slash is added so it looks like this:

/apps/gallery/config/?extramediatypes=1 

The answer to the redirected request is empty. But this doesn’t happen with a shared link, also the request is a little different:

/apps/gallery/config.public?extramediatypes=1&token=foobar

For this request I get a valid JSON response (containing a features / mediatypes object). As a temporary workaround I modified the file apps/gallery/appinfo/routes.php at line 71 so the url for config#get also has a trailing slash. With this the response gets correctly answered and the gallery and slideshow are working even if I am logged in.

Unfortunately I don’t know why the response /apps/gallery/config gets redirected and I don’t know why the second request /apps/gallery/config.public doesn’t get redirected.