Page MenuHomePhorge

Chwala: Folder limit should be configurable
Open, WishlistPublic

Description

Hi Aleksander,
Using the lastest version of chwala, you applied my "hotfix" to comply with the requirements of state of the art webdav services like nextcloud.
To be flexible, the folder limit should be configurable.
Right now the limit is hardcoded, causing the folder tree not to be displayed to the whole extent.
To correct that behavior, only one line has to be changed in the webdav driver file and the corresponding option has to be added to the config.inc.php.

File: webdav_file_storage.php (example could default to 100. IMHO better than 1,noroot)

--- webdav_file_storage.php.ori	2019-03-20 12:32:50.000000000 +0100
+++ webdav_file_storage.php	2019-03-21 07:15:01.354855660 +0100
@@ -1063,7 +1063,7 @@

         try {
             $props = array('{DAV:}resourcetype');
-            $items = $this->client->propfind($root, $props, '1,noroot');
+            $items = $this->client->propfind($root, $props, $this->config['folder_limit'] ? $this->config['folder_limit'] : '1,noroot');
         }
         catch (Exception $e) {
             throw new Exception("User credentials not provided", file_storage::ERROR_NOAUTH);

File config.inc.php: (section: $config['fileapi_sources']) webdav example

$config['fileapi_sources'] = array(
	'Nextcloud' => array(
	    'driver'   => 'webdav',
	    'baseuri'  => 'https://my.nexcloud.local/remote.php/webdav/',
        'username' => '%u',
        'folder_limit' => 'infinity',
	),
    );

Best regards
Franz Skale

Details

Ticket Type
Task

Event Timeline

The whole point is to never use infinity. Now the procedure is recursive and we never fetch more than one level of the folder tree. Or are you saying that your webdav server does not support "1,noroot"?

Hi Aleksander,
first of all, the limit pref has been mentioned in the rfc 8144 not before 2017 and is a Microsoft extension.
Secondly, the Sabre lib, eg. (3.2.3 (2018-10-19)) doesn't support the pref at all.
I scanned the source as well as the Changelog of the Sabre Lib !
You really should treat this pref optional not mandatory though.
You use version 2.1.11 (2016-10-06), so the extension was invented afterwards !
Rgds.
Franz

But you say it's a fix. So, what exactly are you trying to fix? I don't see a problem when I use chwala with Kolab storage connected using webdav driver.

Recently for performance reasons we changed the way in which folders hierarchy is loaded. We fetch top level folders, then we fetch next two levels, and then the rest, in multiple and parallel http requests. We do this for seafile and webdav drivers as kolab driver has fast (imap) folder listing utitlity.

Now, if we want to improve performance on webdav servers with infinity support, we could use your patch, but we should also extend the driver capabilities list for such case with file_storage::CAPS_FAST_FOLDER_LIST => true,. Unfortunately this setting is per-driver not per-mount-point.

So, once again. What is not working properly with the current code?

Hi Aleksandar,
i was on vacation so sorry for the delayed repsonse.
You're using a very old sabre dav library version (2.x) however nextcloud uses a much newer version (3.x).
There's no reference on the pref you're refering to.
Since my patch works but will be ignored by nextcloud (always sending recursive output), how do you treat the option in you code ? (Sabre dav doesn't support the extension at all )

Rgds.
Franz

Please, be more clear. I don't have owncloud installation. Are you saying that it returns full folders hierarchy event if we ask for "1,noroot"? My understanding of owncloud and other dav servers was that they do (may) not support "infinity", but "1,noroot" should be supported. And this is what the rest of the code expects.

I'm running Nextcloud 17 and connected Kolab 16 (both on Debian 10) via webdav.
In my Folder tree I have:

Photos
  2019
     10
     11
     12

Nextcloud itself displays these folders correct.
If I connect with the unpatched chwala, I only see an empty folder Photos.
If I raise the limit as described here I see the complete tree.

So, I agree that there is a problem, but I'm unsure what the correct fix should be.

Debian still packages sabre-dav 1.8.x, 3.x is only in experimental.
But I guess the best way forward might be an update to a current sabre release and
debug from there.