Page MenuHomekolab.org

webdav subfolders are not listed in chwala
Closed, ResolvedPublic

Description

After closing T3763, files in the root folder of owncloud are listed in chwala but subfolders are not properly displayed.
Folders are listed as files with 0 bytes.
In webdav_file_storage.php line 577 :

$is_dir = in_array('{DAV:}collection', $props['{DAV:}resourcetype']->ResourceType);  always return 0

Replacing it with :
$is_dir = isset( $props['{DAV:}resourcetype']); seems to do the job better ( resourcetype is NULL for files) folders are skipped but this way the folders are not listed at all

Later edit: making the same change in list_folders() seems to solve the issue

Details

Ticket Type
Task

Event Timeline

mbadici created this task.Jan 30 2019, 10:56 PM
mbadici updated the task description. (Show Details)Jan 30 2019, 11:04 PM

Hi,
this is covered in my feature request:
https://git.kolab.org/T5239

Best regards
Franz

vanmeeuwen moved this task from Backlog to Reviewed on the Bug Reports board.Mar 27 2019, 7:12 PM
vanmeeuwen lowered the priority of this task from Needs Triage to Low.
vanmeeuwen added a subscriber: vanmeeuwen.

While OwnCloud nor NextCloud WebDAV currently establish a priority for us, WebDAV more generally would.

However, since none of the circumstances articulated are produced from nor reproducible in any environment that is supported, and since this sort of half-assed attempt to make things function apparently requires multiple minor intrusions/distractions/contributions, I'll label this a low priority.

Proposed solution does not work with Kolab's WebDAV implementation (iRony). However, indeed standard says that files have no contenttype, so I'm going to fix it anyway.

However, I don't get it. Does that mean that OwnCloud returns set-but-empty DAV:resourcetype for folders? Could you provide sample owncloud response? Or, is commit d1342141be6 working for you?

mbadici assigned this task to machniak.Jun 24 2019, 5:01 PM

Since there is only one server active using owncloud i keep the patch as it is and it works.
I changed the line as follows, you can see what I log :
// $is_dir = in_array('{DAV:}collection', $props['{DAV:}resourcetype']->ResourceType);

     $is_dir = isset( $props['{DAV:}resourcetype']);


  rcube::write_log('trace2', $props['{DAV:}resourcetype']);

      if ($is_dir) {
rcube::write_log('trace2', $props['{DAV:}resourcetype']);

The log entries are like:

[24-Jun-2019 17:55:55 +0300]: <fdbul94e> NULL
[24-Jun-2019 17:55:55 +0300]: <fdbul94e> NULL
[24-Jun-2019 17:55:55 +0300]: <fdbul94e> NULL
[24-Jun-2019 17:55:55 +0300]: <fdbul94e> Sabre\DAV\Xml\Property\ResourceType::__set_state(array(

 'value' => 
array (
  0 => '{DAV:}collection',
),

))
[24-Jun-2019 17:55:55 +0300]: <fdbul94e> Sabre\DAV\Xml\Property\ResourceType::__set_state(array(

 'value' => 
array (
  0 => '{DAV:}collection',
),

))
[24-Jun-2019 17:55:55 +0300]: <fdbul94e> NULL

It my depend on sabre version, php version, I don't know....

I'm trying to tell you that your patch is not acceptable because it does not work with Kolab's WebDAV server (and maybe others). From the debug you provided I see that it might be a Sabre compat. issue. For me it is different:

Sabre\DAV\Property\ResourceType::__set_state(array(
   'resourceType' => array (
      0 => '{DAV:}collection',
    ),
))

What version of SabreDAV do you have installed?

Could you confirm that this code works for you? I think it should work with SabreDAV 2.1 as well as any newer version.

$is_dir = !empty($props['{DAV:}resourcetype']) && count($props['{DAV:}resourcetype']->getValue()) > 0;
machniak closed this task as Resolved.Jun 26 2019, 2:35 PM

I pushed the the change I proposed above. I consider it fixed. Let me know if I'm wrong.

Sorry but I wasn't at home . Your patch work for me too. In chwala composer.json has: "sabre/dav" : "~2.1.11" I'm not specially attached with this version :)

Chwala is installed from the git repo. Maybe we can simply change the sabre requirement to have a consistent response ?

All other components (iRony, kolab plugins for Roundcube) depend on that version. So, we can't just switch to a new one.

... not mentioning the fact that we still need PHP 5.4 support. So, it's complicated.