dav-server-rs icon indicating copy to clipboard operation
dav-server-rs copied to clipboard

Wrong `quota-used-bytes` returned for collections in `LocalFs`

Open cgrenz opened this issue 2 years ago • 1 comments

DavHandler uses the used space from DavFileSystem::get_quota() only on the root collection.

On every other resource DavMetaData::size() is used instead. On LocalFs that means that every subdirectory only reports an used space of around 4096 bytes (the size of the directory index).

RFC 4331 states:

The DAV:quota-used-bytes value is the value in octets representing the amount of space used by this resource and possibly a number of other similar resources, where the set of "similar" meets at least the criterion that allocating space to any resource in the set will count against the DAV:quota-available-bytes. It MUST include the total count including usage derived from sub-resources if appropriate. It SHOULD include metadata storage size if metadata storage is counted against the DAV:quota-available-bytes.

So for collections it's more correct to re-use the used space from DavFileSystem::get_quota() instead of using DavMetaData::size(), as the size of a directory as reported by the OS doesn't include the sizes of contained files on usual file systems.

cgrenz avatar Mar 18 '23 14:03 cgrenz

Actually fixed by https://github.com/miquels/webdav-handler-rs/pull/11.

However there is no review nor comment from the author for two years.

If @messense would like to also maintain https://github.com/miquels/webdav-server-rs, I am happy to port all my fixes and features from original repo to here.

Vigilans avatar Apr 03 '23 09:04 Vigilans