Unable to download directories

Nextcloud version: 23.0.0
Operating system and version FreeBSD 13
nginx version: 1.20.2_3,2
PHP version: 8.0

The issue you are facing:
When I try to download a folder using the normal web interface, I get an error:

Der Server konnte die Anfrage nicht fertig stellen.
Sollte dies erneut auftreten, sende bitte die nachfolgenden technischen Einzelheiten an Deinen Server-Administrator.
Weitere Details können im Server-Protokoll gefunden werden.
Technische Details

Entfernte Adresse: 10.0.1.90
CNcYXcfMoudPxb93mIHu"

Is this the first time you’ve seen this error? Y

Steps to replicate it:

  1. Try to download a folder.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"uJ0oRfCMBOlEfiJzJZhv","level":3,"time":"2022-01-08T16:03:13+01:00","remoteAddr":"10.0.1.90","user":"nextcloud_admin","app":"index","method":"GET","url":"/index.php/apps/files/ajax/download.php?dir=%2Fgroup_share%2Fdownloads%2F_data&files=7WgtJpTLDCmv604&downloadStartSecret=uykwb3xr4pb","message":"Class \"OCP\\User\" not found","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0","version":"23.0.0.10","exception":{"Exception":"Error","Message":"Class \"OCP\\User\" not found","Code":0,"Trace":[{"file":"/usr/local/www/nextcloud/lib/private/Route/Route.php","line":155,"function":"require_once"},{"function":"OC\\Route\\{closure}","class":"OC\\Route\\Route","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/local/www/nextcloud/lib/private/Route/Router.php","line":310,"function":"call_user_func","args":[{"__class__":"Closure"},{"_route":"files_ajax_download"}]},{"file":"/usr/local/www/nextcloud/lib/base.php","line":1006,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files/ajax/download.php"]},{"file":"/usr/local/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/usr/local/www/nextcloud/apps/files/ajax/download.php","Line":32,"CustomMessage":"--"}}

output of your config.php

(pts/1)[root@nextcloud:/usr/local/www/nextcloud/config]# cat config.php
<?php
$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps',
      'url' => '/apps',
      'writable' => true,
    ),
    1 =>
    array (
      'path' => '/usr/local/www/nextcloud/apps-pkg',
      'url' => '/apps-pkg',
      'writable' => false,
    ),
  ),
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => 0,
  'logtimezone' => 'Europe/Berlin',
  'log_rotate_size' => 104857600,
  'filelocking.enabled' => true,
  'filelocking.debug' => false,
  'filesystem_check_changes' => 1,
  'htaccess.RewriteBase' => '/',
  'integrity.check.disabled' => false,
  'knowledgebaseenabled' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'dbindex' => 0,
  ),
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'default_locale' => 'de_DE',
  'default_language' => 'de',
  'versions_retention_obligation' => 'auto',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.xxx',
  ),
  'datadirectory' => '/usr/local/nextcloud/data/',
  'dbtype' => 'pgsql',
  'version' => '23.0.0.10',
  'overwrite.cli.url' => 'https://nextcloud.xxx',
  'trusted_proxies' =>
  array (
    0 => '10.0.1.1',
  ),
  'overwritehost' => 'nextcloud.xxx',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'sqlserver.lan.xxx',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'ldapUserCleanupInterval' => 5,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  0 => 'ldapUserCleanupInterval => 50',
  'maintenance' => false,
  'theme' => '',
  'activity_expire_days' => 31,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'xxx',
  'mail_domain' => 'xxx',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
);

The output of your nginx/system log in /var/log/nginx/access.log:

10.0.1.1 - - [08/Jan/2022:16:10:57 +0100] "GET /index.php/apps/files/ajax/download.php?dir=%2Fgroup_share%2Fdownloads%2F_data&files=7WgtJpTLDCmv604&downloadStartSecret=0muhnsxfr0eg HTTP/1.1"
10.0.1.1 - - [08/Jan/2022:16:11:08 +0100] "GET /index.php/204 HTTP/1.1"

Topic can be closed. I managed to find the solution. I use freebsd as the base system. In freebsd there are two different app folders 1. apps and 2. apps_pkg. Although havong app_pkg set in the config.php something messed up during updates. For some reason the apps which should have directories only in apps_pkg also had their outdated versions in apps. That was the reason for the error message OCP\User not found. After cleaning up the apps folder by deleting the outdated files, nextcloud only used the proper and current files from the apps_pkg folder. After that I got a proper error message:

Error: require_once(/usr/local/www/nextcloud/apps/files/ajax/download.php): Failed to open stream: No such file or directory at /usr/local/www/nextcloud/lib/private/Route/Route.php#155

Hence it became clear, that not all files were told using the apps_pkg folder. I just saved my config.php file, rm -rf /usr/local/www/nextcloud and performed a fresh install via ports.

After that everything is working fine. As a plus my nextcloud installation is now pretty much cleaned up.

1 Like