WebDAV: cannot copy a file that is the root of webdav - possibly due to assumption root is a directory

What is the problem you are having with rclone?

Owncloud allows for sharing of files using just a link. This is documented and there is a public webdav endpoint as documented here. I'm using rclone successfully with other owncloud shares using the remote.php/webdav style where directories of files are being shared. However, in this case the link is also protected with a password making it difficult to access the data from the endpoint.

When attempting to list the remote with lsl no output is shown (> is my prompt here).

> rclone -vv lsl owncloud-remote:/
2022/02/28 16:39:02 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "-vvv" "lsl" "owncloud-remote:/"]
2022/02/28 16:39:02 DEBUG : Creating backend with remote "owncloud-remote:/"
2022/02/28 16:39:02 DEBUG : Using config file from "/home/user/.config/rclone/rclone.conf"
2022/02/28 16:39:02 DEBUG : found headers: 
2022/02/28 16:39:02 DEBUG : fs cache: renaming cache item "owncloud-remote:/" to be canonical "owncloud-remote:"
2022/02/28 16:39:02 DEBUG : 4 go routines active
>

Using curl to debug this a little shows the correct information for the file shared at the URL

> curl -u share_id:password -X PROPFIND -H 'Depth: 1' https://owncloud-instance.org/public.php/webdav/ | xmllint --format -
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/public.php/webdav/</d:href>
    <d:propstat>
      <d:prop>
        <d:getlastmodified>Thu, 24 Feb 2022 03:59:45 GMT</d:getlastmodified>
        <d:getcontentlength>20552402535</d:getcontentlength>
        <d:resourcetype/>
        <d:getetag>"0d38ee72ab7a1a12970c57fff82c468b"</d:getetag>
        <d:getcontenttype>application/x-gzip</d:getcontenttype>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Doing this has also shown that downloading using curl for these links is possible with just the -u share_id:password, but wonder if this is something rclone could support too.

What is your rclone version (output from rclone version)

> rclone version
rclone v1.57.0
- os/version: centos 7.9.2009 (64 bit)
- os/kernel: 3.10.0-1160.45.1.el7.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.2
- go/linking: static
- go/tags: none

Can you share the config file please (redact as necessary)?

Can you run your rclone command with -vv --dump bodies and post the output?

Webdav can supply user and password - have you tried that?

Thanks for the reply, here's the output of dump bodies (xml response linted with xmllint for legibility). The auth looks successful and the response differs from the curl posted above in the obvious missing displayname property.

2022/03/01 09:38:29 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "-vv" "--dump" "bodies" "lsl" "owncloud-remote:"]
2022/03/01 09:38:29 DEBUG : Creating backend with remote "owncloud-remote:"
2022/03/01 09:38:29 DEBUG : Using config file from "/home/hrards/.config/rclone/rclone.conf"
2022/03/01 09:38:29 DEBUG : found headers: 
2022/03/01 09:38:29 DEBUG : You have specified to dump information. Please be noted that the Accept-Encoding as shown may not be correct in the request and the response may not show Content-Encoding if the go standard libraries auto gzip encoding was in effect. In this case the body of the request will be gunzipped before showing it.
2022/03/01 09:38:29 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/03/01 09:38:29 DEBUG : HTTP REQUEST (req 0xc000728500)
2022/03/01 09:38:29 DEBUG : PROPFIND /public.php/webdav/ HTTP/1.1
Host: owncloud-instance.org
User-Agent: rclone/v1.57.0
Content-Length: 287
Authorization: XXXX
Depth: 1
Referer: https://owncloud-instance.org/public.php/webdav/
Accept-Encoding: gzip

<?xml version="1.0"?>
<d:propfind  xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
 <d:prop>
  <d:displayname />
  <d:getlastmodified />
  <d:getcontentlength />
  <d:resourcetype />
  <d:getcontenttype />
  <oc:checksums />
 </d:prop>
</d:propfind>
2022/03/01 09:38:29 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2022/03/01 09:38:30 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/03/01 09:38:30 DEBUG : HTTP RESPONSE (req 0xc000728500)
2022/03/01 09:38:30 DEBUG : HTTP/1.1 207 Multi-Status
Transfer-Encoding: chunked
Cache-Control: no-store, no-cache, must-revalidate
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *
Content-Type: application/xml; charset=utf-8
Date: Mon, 28 Feb 2022 20:38:30 GMT
Dav: 1, 3, extended-mkcol, 2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Server: CloudStor
Set-Cookie: 5230042dc1897=umkn9kk8md82b8rf4po3ss2pkf; path=/;; Secure
Set-Cookie: oc_sessionPassphrase=qgbgTW753vr3buiBWY9ZVqTf8EwloRdL8E3yW1IL92vIcls83AbCXyOLEwZe3W1pT8MVxcd%2FSzhGDLdxIRc9VLZ8oh7ygDSIq2g%2BZHQUh7k9eVWILR2dh%2BZyvtHQbmNc; path=/;; Secure
Set-Cookie: SimpleSAMLSessionID=6e7b7e0fdef3e7a11ab0582f95d6b8fc; path=/; HttpOnly; Secure
Strict-Transport-Security: max-age=15768000
Vary: Brief,Prefer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Robots-Tag: none
X-Xss-Protection: 1; mode=block

2d7
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/public.php/webdav/</d:href>
    <d:propstat>
      <d:prop>
        <d:getlastmodified>Thu, 24 Feb 2022 03:59:45 GMT</d:getlastmodified>
        <d:getcontentlength>20552402535</d:getcontentlength>
        <d:resourcetype/>
        <d:getcontenttype>application/x-gzip</d:getcontenttype>
        <oc:checksums>
          <oc:checksum>SHA1:a14f37b095881303a08fa3edfd929a2600ecc8d3 MD5:6aae800611f0250a5a13f31bd6f0f88c ADLER32:acbfd314</oc:checksum>
        </oc:checksums>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
    <d:propstat>
      <d:prop>
        <d:displayname/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>
0

2022/03/01 09:38:30 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2022/03/01 09:38:30 DEBUG : 4 go routines active

Thanks for the nice log.

I think rclone is confused here because the href indicated it is a collection (ie a directory) by the trailing /

However the rest of the response indicated it is a file

Etc.

Can you try using the URL (and the owncloud-remote:/) without the trailing / and see if that helps?

The 4 permutations of config URL and remote:path (with and without trailing /) all have the same result.

[owncloud-remote]
type = webdav
url = https://owncloud-instance.org/public.php/webdav
vendor = owncloud
user = ...
pass = ...

No matter the url in the config or the path (empty or /) the href in the response is always <d:href>/public.php/webdav/</d:href>

I'm starting to think the empty/not found display name is an owncloud bug, possibly this one

OK, it was worth a try!

So it is trying to advertise a collection (directory) with one file in presumably

But without a name that rclone can display.

Yes this seems like an owncloud bug most likely. That is certainly an odd XML response!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.