Page MenuHomePhorge

Seafile as sole storage driver doesn't load subfolders
Open, LowPublic

Description

When using seafile as sole storage provider, I get all available repos listed and the files on the root level but no subfolders are queries.

On the oppsite, when using seafile as addon driver subfolders are correctly loaded and shown.

root@mx01:/etc/roundcubemail# dpkg -l | egrep "kolab.files|chwala"
ii  chwala                                      0.5.5-0~kolab2                               all          Glorified WebDAV, done right
ii  roundcubemail-plugin-kolab-files            1:3.4.3-0~kolab3                             all          kolab_files plugin for Roundcube

Currently digging into the code. But it must have something to do with the way repos and folders are threated on root level or in a storage-driver-folder (when used as addon and repos are already considered like a subfolder in the treeview).

btw. loggin into /chwala/ every repo and subfolder is listed correctly. The issue only exists in the kolab_files plugin logic.

Details

Ticket Type
Task

Event Timeline

Yes, kolab_files uses now different (semi-recurrent) logic to fetch folders hierarchy. How exactly did you configure chwala with seafile?

I think we should finally remove that section from documentation. It is not supported scenario, I think it is not even supposed to work. There's a comment in sample config:

// Main files source, backend driver which handles
// authentication and configuration of Chwala
// Note: Currently only 'kolab' is supported
$config['fileapi_backend'] = 'kolab';

... and we should throw an error when fileapi_backend != 'kolab'.

Hmmm But in theory it could work. I get the list of repositories. Chwala works correctly and lists all folders. Just kolab_files doesn’t get over it and doesn’t request the subfolders of each repo which is presented. BTW the files on the roots of each repo are shown as well.

We’re not sooo far away from a working version. Not sure what the chwala frontend does different

That scenario is not supported because you can't store config and you can't use cache without kolab backend. You could probably live without these in some setups, so yes in theory it should work. There must be a bug somewhere.

Chwala frontend requests the full hierarchy in one request, webmail uses multiple semi-recursive requests (with specified level). So, probably handling of level in your scenario is broken. Check 'level' handling in folder_list() method of file_api_common and seafile_file_storage.

Okay I’ll take a look on it later. I guess it’s this part:
https://git.kolab.org/diffusion/C/browse/master/lib/drivers/seafile/seafile_file_storage.php$918

When the seafile driver only returns a list of repositories, kolab_files never starts to dig deeper.

On the other hand: if switching back to the kolab file backend, is there a way to auto add the seafile backend as additional driver with a given host and the login credentials? This would remove the hassle that everyone has to add seafile manually?

$config['fileapi_sources'] = array(
    'Seafile' => array(
        'driver' => 'seafile',
        'host'   => 'seacloud.cc',
        // when username is set to '%u' current user name and password
        // will be used to authenticate to this storage source
        'username' => '%u',
    )
);
// You can also add
$config['fileapi_backend_storage_disabled'] = true;

I did some debugging in the seafile_file_storage class.

public function folder_list($params = array())
   {
       rcube::write_log('console', __METHOD__." = ".json_encode($params,JSON_PRETTY_PRINT);

From what I can see: when seafile is used as sole storage. the level initial folder_list requests starts with level=1 compared to the seafile-addon-driver solution the initial requests stars with level=2.+

Sole:

[12-Apr-2019 20:53:31,265791 +0200]: <1ns0a2uf> seafile_file_storage::folder_list = {
    "type": 0,
    "extended": true,
    "permissions": true,
    "auto_level": true,
    "level": 1
}

Addon:

[12-Apr-2019 21:00:16,327592 +0200]: <m3qnhuu2> seafile_file_storage::folder_list = {
    "type": 0,
    "extended": true,
    "permissions": true,
    "level": 2,
    "path": false
}

This situation where the root level changes depending your using the seafie as sole or addon driver makes internally a totally starting point. without adding a detection and therefore change various level conditions through the whole driver makes totally no sense.

I'll see that I can update the seafile howto on docs.

machniak lowered the priority of this task from Needs Triage to Low.Sep 27 2023, 9:30 AM