Pictures in gallery cannot be displayed

Nextcloud version (eg, 20.0.5): 24.0.5
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.5 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx/1.21.6
PHP version (eg, 7.4): PHP 7.4.29

The issue you are facing:

When accessing pictures via web browser, either as a guest via a share link or as a logged on user, previews are not created and the file cannot be shown. Instead, I see the message “Fehler beim Laden von ” (error loading ).
Downloading of the picture is not possible as well. Instead of a download of the single file, Nextcloud creates a zip file (as if I were to download multiple files at once). After unzipping, I see the full folder structure containing just the single file that I wanted to download, but it has a size of zero byte.
The pictures are correctly synced as I can view them both on mobile by using the Nextcloud app, as well as on my laptop.

In Admin -> Logging I see multiple instances of the following error message:

Exception: Argument 1 passed to OC\PreviewManager::getPreview() must be an instance of OCP\Files\File, instance of OC\Files\Node\Folder given, called in /var/www/nextcloud/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 120 in file '/var/www/nextcloud/lib/private/PreviewManager.php' line 211

Somehow, Nextcloud seems to think that the pictures I am browsing are folders?

Is this the first time you’ve seen this error? (Y/N): I identified the issue today but I seldomly view/share pictures so I don’t know how long this might be present.

Steps to replicate it:

Hard to say, for me it’s effective for every file that I want to view.

The output of your Nextcloud log in Admin > Logging:

See above

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' => 
  array (
    0 => 'REDACTED',
  ),
  'trusted_proxies' => 
  array (
    0 => 'REDACTED',
  ),
  'datadirectory' => '/var/nc_data',
  'dbtype' => 'mysql',
  'version' => '24.0.4.1',
  'overwrite.cli.url' => 'https://REDACTED',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'instanceid' => 'REDACTED',
  'activity_expire_days' => 14,
  'auth.bruteforce.protection.enabled' => true,
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
  ),
  'default_phone_region' => 'DE',
  'cron_log' => true,
  'enable_previews' => true,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
  ),
  'filesystem_check_changes' => 0,
  'filelocking.enabled' => 'true',
  'htaccess.RewriteBase' => '/',
  'integrity.check.disabled' => false,
  'knowledgebaseenabled' => false,
  'logfile' => '/var/nc_data/nextcloud.log',
  'loglevel' => 2,
  'logtimezone' => 'Europe/Berlin',
  'log_rotate_size' => 104857600,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwriteprotocol' => 'https',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'quota_include_external_storage' => false,
  'share_folder' => '/Shares',
  'skeletondirectory' => '',
  'theme' => '',
  'trashbin_retention_obligation' => 'auto, 7',
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'cookbook',
  ),
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'REDACTED',
);

The output of your Apache/nginx/system log in /var/log/____:

Nothing that seems of interest, can provide more info if required.