Problem with image preview updating

Nextcloud version: 25.0.1
Operating system and version: Ubuntu 20.04.4
Apache or nginx version: Apache/2.4.41
PHP version: PHP 7.4.3
Is this the first time you’ve seen this error? (Y/N): N
Steps to replicate it:

  1. Upload any image with a specific name
  2. Check (open) preview for this specific file
  3. Replace (do not delete) image with another file with the same specific name (including extension)
  4. Reopen preview for this file: you will see an old preview for file that was uploaded on step one.

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

<?php $CONFIG = array ( 'passwordsalt' => '', 'secret' => '', 'trusted_domains' => array ( 0 => '', 1 => '', 2 => '', 3 => '', ), 'datadirectory' => '', 'dbtype' => 'pgsql', 'version' => '25.0.1.1', 'overwrite.cli.url' => '', 'dbname' => '', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => '', 'dbpassword' => '', 'installed' => true, 'instanceid' => '', 'default_phone_region' => 'RU', 'log_type' => 'file', 'logfile' => '/var/log/nextcloud/nextcloud.log', 'loglevel' => '2', 'log.condition' => array ( 'apps' => array ( 0 => 'admin_audit', ), ), 'auth.bruteforce.protection.enabled' => false, 'mail_smtpmode' => 'smtp', 'logtimezone' => 'Europe/Moscow', 'maintenance' => false, 'ldapIgnoreNamingRules' => false, 'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory', 'theme' => '', 'mail_smtpsecure' => 'tls', 'mail_sendmailmode' => 'smtp', 'mail_from_address' => '', 'mail_domain' => '', 'mail_smtphost' => '', 'mail_smtpport' => '', 'mail_smtpauth' => 1, 'mail_smtpname' => '', 'mail_smtppassword' => '', 'skeletondirectory' => '/var/www/nextcloud/default-files', 'preview_libreoffice_path' => '/usr/bin/libreoffice', 'enable_previews' => true, 'preview_max_memory' => 10000, 'jpeg_quality' => 60, 'preview_max_x' => 512, 'preview_max_y' => 512, 'preview_max_scale_factor' => 1, 'enabledPreviewProviders' => array ( 0 => 'OC\\Preview\\TXT', 1 => 'OC\\Preview\\MarkDown', 2 => 'OC\\Preview\\OpenDocument', 3 => 'OC\\Preview\\PDF', 4 => 'OC\\Preview\\MSOffice2003', 5 => 'OC\\Preview\\MSOfficeDoc', 6 => 'OC\\Preview\\Image', 7 => 'OC\\Preview\\Photoshop', 8 => 'OC\\Preview\\TIFF', 9 => 'OC\\Preview\\SVG', 10 => 'OC\\Preview\\Font', 11 => 'OC\\Preview\\MP3', 12 => 'OC\\Preview\\Movie', 13 => 'OC\\Preview\\MKV', 14 => 'OC\\Preview\\MP4', 15 => 'OC\\Preview\\AVI', ), 'templatedirectory' => '', 'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.distributed' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => '127.0.0.1', 'port' => 6379, ), 'memcache.locking' => '\\OC\\Memcache\\Redis', 'app_install_overwrite' => array ( 0 => 'limit_login_to_ip', 1 => 'hancomoffice', ), 'updater.secret' => '', );