Reading Hashes (MD5 or SHA1) via WebDAV

Hi!

I’ve written a webdav integration with Owncloud for rclone and it works very well. However I haven’t added checksum support yet - I’d like a bit of guidance if possible.

I see that Owncloud appears to store the SHA1 hashes on the objects. For instance when I HEAD an object I see

OC-Checksum: SHA1:f572d396fae9206628714fb2ce00f72e94f2258f

I found some documentation for this: https://doc.owncloud.org/desktop/2.4/architecture.html#upload

Will this always be an SHA1? Or do I have to retrieve the server properties to check the supported values? rclone support SHA-1 and MD5 so either of those would be great, but I need to know at the start of a sync which are supported.

Is it possible to retrieve the SHA-1 as a webdav property? This would be most convenient then I could retrieve it in the listings rather than having to do a HEAD request to retrieve it off the object headers?

Thanks for any help and apologies if I’ve missed the bits in the docs.

Hey, i have seen @PVince81, @DeepDiver1975 or @ilja answering to development specific questions here. Maybe they can give some background?

1 Like

You can query the “oc:checksum” property when doing a PROPFIND.

To know what checksums are supported, query the capabilities OCS endpoint and look at “checksums.supportedTypes”. From what I see SHA-1 is currently hard-coded there.(https://github.com/owncloud/core/blob/v10.0.8/apps/files/lib/Capabilities.php#L56)

2 Likes

Thanks you, that is very helpful.

Is there a list of WebDAV properties somewhere in the docs? Google and I couldn’t find one!

I guess I can do an allprops query to see what is available

    <?xml version="1.0" ?>
    <D:propfind xmlns:D="DAV:">
            <D:allprop/>
    </D:propfind>

Would there be a lot of overhead for owncloud if I did that for every query?

Thank you very much for your help.

I don’t think “allprop” will work, it will likely only report some of the common properties.

There is currently no exhaustive list of properties, we should add these in the documentation.

Raised here to gather a list: https://github.com/owncloud/documentation/issues/4244

You could look at the Network console in the browser when the file list is doing a PROPFIND to see most of the existing customer properties related to files.

1 Like

OK, thanks.

Great,

I’ll also try grepping the source code and see what I find!