emersion / go-webdav

A Go library for WebDAV, CalDAV and CardDAV
MIT License
314 stars 66 forks source link

webdav: add size to FileSystem.Create() #153

Open DeepDiver1975 opened 4 months ago

DeepDiver1975 commented 4 months ago

In some cases the total size is necessary upfront to perform the upload to an external system.

And even if not it is good to have it as a minimal test to see if data was transmitted completely ....

Open question: how to address other valuable headers like checksums or what ever ....

maybe we pass the full request object to Create()? Or body + headers?

@emersion any objections/idea?

emersion commented 4 months ago

Hm right… I think the use-case is reasonable, but backends should keep in mind that the size is just a hint, it may be unset (-1). Also, HTTP compression (Content-Encoding) will always leave Content-Length unset.