Errors shown when accessing shared file link

Nextcloud version: 27.0.2
Operating system and version: Ubuntu 20.04
Apache or nginx version: 2.4.41
PHP version: 8.2

The issue you are facing: When I upload a file (via either client or web interface), I can access it just fine in the web interface and view it in the browser.

However, if I share it with a link, when I access that link I see, “Error loading [filename]”.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Upload a file via either client or web interface
  2. Share with a link
  3. Access the link in a browser.

The output of your Nextcloud log in Admin > Logging:

[no app in context] Error: OC\ServerNotAvailableException: Legacy cipher is no longer supported! at <<closure>>

 0. /path_to/apps/encryption/lib/Crypto/Crypt.php line 423
    OCA\Encryption\Crypto\Crypt->getLegacyCipher()
 1. /path_to/apps/encryption/lib/KeyManager.php line 475
    OCA\Encryption\Crypto\Crypt->decryptPrivateKey("*** sensitive parameters replaced ***")
 2. /path_to/apps/encryption/lib/Crypto/Encryption.php line 524
    OCA\Encryption\KeyManager->getFileKey()
 3. /path_to/lib/private/Files/Storage/Wrapper/Encryption.php line 352
    OCA\Encryption\Crypto\Encryption->isReadable()
 4. /path_to/lib/private/Files/Storage/Wrapper/Wrapper.php line 173
    OC\Files\Storage\Wrapper\Encryption->isReadable()
 5. /path_to/lib/private/Files/View.php line 1143
    OC\Files\Storage\Wrapper\Wrapper->isReadable()
 6. /path_to/lib/private/Files/View.php line 478
    OC\Files\View->basicOperation()
 7. /path_to/lib/private/Files/Filesystem.php line 529
    OC\Files\View->isReadable()
 8. /path_to/lib/private/legacy/OC_Files.php line 340
    OC\Files\Filesystem::isReadable()
 9. /path_to/lib/private/legacy/OC_Files.php line 123
    OC_Files::getSingleFile()
10. /path_to/apps/files_sharing/lib/Controller/ShareController.php line 520
    OC_Files::get()
11. /path_to/lib/private/AppFramework/Http/Dispatcher.php line 230
    OCA\Files_Sharing\Controller\ShareController->downloadShare()
12. /path_to/lib/private/AppFramework/Http/Dispatcher.php line 137
    OC\AppFramework\Http\Dispatcher->executeController()
13. /path_to/lib/private/AppFramework/App.php line 183
    OC\AppFramework\Http\Dispatcher->dispatch()
14. /path_to/lib/private/Route/Router.php line 315
    OC\AppFramework\App::main()
15. /path_to/lib/base.php line 1071
    OC\Route\Router->match()
16. /path_to/index.php line 36
    OC::handleRequest()

GET /s/[…]/download?path=&files=my_file.mp4
from 193.227.108.10 at 2023-08-29T08:50:06+00:00

and:

[PHP] Error: Undefined variable $event at /path_to/lib/private/legacy/OC_Files.php#238

GET /s/[…]/download?path=&files=my_file.mp4
from 193.227.108.10 at 2023-08-29T08:50:06+00:00

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

<?php
$CONFIG = array (
  'passwordsalt' => '[passwordsalt]',
  'datadirectory' => '[datadirectory]',
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'dbname' => '[dbname]',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => '[dbuser]',
  'dbpassword' => '[dbpassword]',
  'installed' => true,
  'instanceid' => '[instanceid]',
  'ldapIgnoreNamingRules' => false,
  'forcessl' => true,
  'maintenance' => true,
  'singleuser' => false,
  'theme' => '',
  'defaultapp' => 'files',
  'knowledgebaseenabled' => true,
  'appstoreenabled' => true,
  'updatechecker' => true,
  'updater.server.url' => 'https://updates.nextcloud.com/updater_server/',
  'has_internet_connection' => true,
  'check_for_working_webdav' => true,
  'check_for_working_htaccess' => true,
  'check_for_working_wellknown_setup' => true,
  'loglevel' => 0,
  'trusted_domains' => 
  array (
    0 => '[my_domain]',
  ),
  'cron_log' => true,
  'secret' => '[secret]',
  'mail_from_address' => 'admin',
  'mail_smtpmode' => 'sendmail',
  'mail_domain' => '[mail_domain]',
  'trashbin_retention_obligation' => 'auto',
  'htaccess.RewriteBase' => '/',
  'tempdirectory' => '[tempdirectory]',
  'asset-pipeline.enabled' => true,
  'session_keepalive' => true,
  'overwrite.cli.url' => '[url]',
  'updater.release.channel' => 'stable',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
    1 => 'occweb',
    2 => 'spreed',
    3 => 'passwords',
  ),
  'encryption.legacy_format_support' => true,
  'encryption.key_storage_migrated' => false,
  'default_phone_region' => '[default_phone_region]',
);

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

Nothing relevant to this error (nothing shown at that exact time).

In config.php:

  'encryption.legacy_format_support' => false,

Result of encryption:status:

  - enabled: true
  - defaultModule: OC_DEFAULT_MODULE

Sorry i do not use server side encryption because i do not use external storage and without external storage it makes no sense for me.

You can read this. Maybe you can execute

occ encryption:scan:legacy-format

Maybe you find files (the problem files) in old format. But as I said, I’m not familiar with it.

Nope, the result of that command is: “All scanned files are properly encrypted. You can disable the legacy compatibility mode.”

Why, in the world, with legacy format disabled and no legacy files remaining, is a share link being created with relies on the legacy format?!?