From b03b7955cf25e863c1aac2853ddaf647bfb70ea8 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Mon, 11 May 2020 14:16:48 +0200 Subject: dav: Be sure that enumeration is possible when looking for a root The DAV backend tries to find the top-most directory when mounting. Unfortunatelly, for example with nextcloud.com, the enumeration job fails with `Method not allowed` error for the root directory found by this logic: ``` Sabre\DAV\Exception\MethodNotAllowed Listing members of this collection is disabled ``` This is because nextcloud.com prevents listing of its users. Let's change the mount logic and always require info about children to be sure that enumeration won't fail later. Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/468 --- daemon/gvfsbackenddav.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c index 4ac94aca..5929ab6a 100644 --- a/daemon/gvfsbackenddav.c +++ b/daemon/gvfsbackenddav.c @@ -1446,7 +1446,6 @@ stat_location (GVfsBackend *backend, return res; } - /* ************************************************************************* */ /* Authentication */ @@ -1930,8 +1929,10 @@ do_mount (GVfsBackend *backend, last_good_path = NULL; msg_opts = soup_message_new_from_uri (SOUP_METHOD_OPTIONS, mount_base); - msg_stat = stat_location_begin (mount_base, FALSE); + /* The count_children parameter is intentionally set to TRUE to be sure that + enumeration is possible: https://gitlab.gnome.org/GNOME/gvfs/-/issues/468 */ + msg_stat = stat_location_begin (mount_base, TRUE); do { GFileType file_type; @@ -2012,7 +2013,7 @@ do_mount (GVfsBackend *backend, if (is_collection == FALSE) break; - + /* we have found a new good root, try the parent ... */ g_free (last_good_path); last_good_path = mount_base->path; -- cgit v1.2.1