Folders shared by links contain an empty list of files

Nextcloud version : 29.0.2
Operating system and version : 22.04.4 LTS
Apache or nginx version : 2.4.52
PHP version: 8.3.8

The issue you are facing:

There is a problem after updating Nextcloud and PHP. Public Share links open but the list of files is empty. At the same time, all other elements are present. You can download all the files, the download button works. I didn’t find any solutions on the web.

For logged user all fine.

PS. I am using NGINX PROXY

Is this the first time you’ve seen this error? (Y/N):Y

Steps to replicate it:

The output of your Nextcloud log in Admin > Logging:

Undefined array key 0 at /var/www/html/nextcloud/apps/dav/appinfo/v2/publicremote.php#96

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

<?php
$CONFIG = array (
  'instanceid' => 'xxoc2xxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxx',
  'secret' => 'xxxxxxxyjS9xxxx',
  'trusted_domains' => 
  array (
    0 => 'cloud.xxx.net',
    1 => '192.168.100.121',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '29.0.2.2',
  'overwrite.cli.url' => 'https://cloud.xxx.net',
  'dbname' => 'xxxxxxxx',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxx',
  'dbpassword' => 'xxxxxxxxx',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'default_phone_region' => 'BY',
  'updater.release.channel' => 'stable',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'apporder',
    1 => 'files_archive',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'nextcloud',
  'allow_local_remote_servers' => true,
  'maintenance_window_start' => 1,
);

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

  GNU nano 6.2                                                                          error.log                                                                                   
[Thu Jun 13 00:00:01.248560 2024] [ssl:warn] [pid 206:tid 140284545992576] AH01909: NextCloudCT.local:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 13 00:00:01.248691 2024] [ssl:warn] [pid 206:tid 140284545992576] AH01916: Init: (NextCloudCT.local:443) You configured HTTP(80) on the standard HTTPS(443) port!
[Thu Jun 13 00:00:01.248845 2024] [mpm_event:notice] [pid 206:tid 140284545992576] AH00489: Apache/2.4.52 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 configured -- resuming normal oper>
[Thu Jun 13 00:00:01.248870 2024] [core:notice] [pid 206:tid 140284545992576] AH00094: Command line: '/usr/sbin/apache2'

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

{"reqId":"6mGTrpzUgjTBsZd2CSeQ","level":3,"time":"2024-06-12T08:32:23+00:00","remoteAddr":"192.168.100.219","user":"--","app":"PHP","method":"PROPFIND","url":"//public.php/dav/files/tSAPKsF2t4HEFMC/","message":"Undefined array key 0 at /var/www/html/nextcloud/apps/dav/appinfo/v2/publicremote.php#96","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0","version":"29.0.2.2","data":{"app":"PHP"}}

1 Like

Hi @kosmel,

I’ve the same issue after an update to version 29.0.4. The browser client gets 404 errors while accessing the page with the share content.

Request URL: https://example.com/public.php/dav/files/63s7B4wAcWZbbBo/
Request Method: PROPFIND
Status Code: 404 Not Found

Request URL: https://example.com/ocs/v2.php/apps/text/public/workspace?path=%2F&shareToken=63s7B4wAcWZbbBo
Request Method: GET
Status Code: 404 Not Found

As you said, to download the content is possible. To share a single File does work. It’s only related to share links that share a folder.
In my case, all folder shares are affected. Even those that existed before the update.

I found a few old entries on a similar problem and looked at the solutions mentioned there. However, this did not solve the problem.

Have you found a workaround or solution?

No, still have a issue :frowning:

I cannot reproduce this problem. At least not on 29.0.5.

Are you sure you don’t have anything unconventional in place in your web config? For example, do you use the bundled .htaccess file or do you manage your own web server config?

Hi @kosmel , hi @jtr,

I was able to debug the issue but have only a temporary solution for now. Maybe kosmel can test my intermediate solution.

After looking into the php code which is executed when the requests are made I noticed, that the request URL gets parsed with the php pregmatch function.

diff /var/www/nextcloud-fixed/apps/dav/appinfo/v2/publicremote.php /var/www/nextcloud/apps/dav/appinfo/v2/publicremote.php
95,96c95
<
< preg_match('/files\/\w+/i', substr($requestUri, strlen($baseuri)), $match);
---
> preg_match('/(^files\/\w+)/i', substr($requestUri, strlen($baseuri)), $match);

As you can see I changed the regex and removed the match group. With that match group the result is empty. Without the match group, the correct part of the URL gets extracted and is inserted in the array which then is not empty anymore.

I had the same issue as @kosmel which said
Undefined array key 0 at /[...]/apps/dav/appinfo/v2/publicremote.php#96 and this was a hint to look at the content of the array and why it is empty. I ended up at the preg_match function in the end.

I set up a new nextcloud for debugging on another system but wasn’t able to reproduce the issue. I read a few issues related php, opcache, jit and the preg_match function. There were a few issues which could end in different results depending on config settings of the php environment (opcache and jit). One example: Different preg_match result with `-d pcre.jit=0` · Issue #11374 · php/php-src · GitHub

So for now @jtr brings the right question to this topic. I think it’s related to the environment and therefore not every user is hit by this issue.

These are my environments:

  • Debian bullseye with newest sury php packages (testet 8.2 and 8.1) with opcache and jit enabled. This setup is working whithout temporary fix.
  • Debian bookworm with newest sury php packages (tested 8.2 and 8.1) with opcache and jit enabled. This setup is not working without the temporary fix.

I use the bundled .htaccess file in both installations.

I tried all combinations of with an without opcache and jit. I was not able to find the reason at all but at the moment I think it’s more php related and not an issue nextcloud can fix.

I’ve not finished debugging but due to the workaround it’s not that urgent anymore. I have not a lot of time to debug further but will give more information or a possible final solution if found.

I have made several updates from version 26 to version 29. Before the update, the external links worked well. The configuration of the web server was not changed when updating.

I tried about 10 solutions from the Internet before writing on this forum, nothing helped me.

I think you are right, a problem may be with the configuration of the web server.

I was try to install new blank install of nextcloud 29 and i get this problem

This is a same folder for logged user (left) and for public share (right):