webdav: optimize performance by using Depth=0 for metadata requests by ZRHann · Pull Request #9263 · rclone/rclone

What is the purpose of this change?

Currently, readMetaDataForPath uses the default Depth=1 for PROPFIND requests. This returns a list of files. However, in the subsequent code, we only ever use result.Responses[0].

This PR changes the PROPFIND request in readMetaDataForPath to use Depth=0 to optimize performance. The improvement is very noticeable when a directory contains many files. The time for rclone ls is reduced by almost 50%.

Since readMetaDataForPath only uses the first response anyway, this change should be completely equivalent logically.

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)