webdav: add support for If-Match/If-None-Match in FileSystem.Create
This commit is contained in:
13
webdav.go
13
webdav.go
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user