webdav: add support for If-Match/If-None-Match in FileSystem.Create

This commit is contained in:
Simon Ser
2024-12-09 22:31:59 +01:00
parent 93fee5bcf0
commit 9d778f4072
3 changed files with 43 additions and 7 deletions

View File

@@ -19,6 +19,11 @@ type FileInfo struct {
ETag string
}
type CreateOptions struct {
IfMatch ConditionalMatch
IfNoneMatch ConditionalMatch
}
type CopyOptions struct {
NoRecursive bool
NoOverwrite bool
@@ -48,3 +53,11 @@ func (val ConditionalMatch) ETag() (string, error) {
}
return string(e), nil
}
func (val ConditionalMatch) MatchETag(etag string) (bool, error) {
if val.IsWildcard() {
return true, nil
}
t, err := val.ETag()
return t == etag, err
}