2020-01-21 20:01:18 +00:00
|
|
|
// Package webdav provides a client and server WebDAV filesystem implementation.
|
|
|
|
//
|
|
|
|
// WebDAV is defined in RFC 4918.
|
|
|
|
package webdav
|
2020-01-21 21:36:42 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2024-01-18 12:37:21 +00:00
|
|
|
|
|
|
|
"github.com/emersion/go-webdav/internal"
|
2020-01-21 21:36:42 +00:00
|
|
|
)
|
|
|
|
|
2024-01-08 13:35:19 +00:00
|
|
|
// FileInfo holds information about a WebDAV file.
|
2020-01-21 21:36:42 +00:00
|
|
|
type FileInfo struct {
|
2020-01-22 10:07:30 +00:00
|
|
|
Path string
|
2020-01-21 21:43:13 +00:00
|
|
|
Size int64
|
|
|
|
ModTime time.Time
|
|
|
|
IsDir bool
|
|
|
|
MIMEType string
|
2020-01-22 10:51:05 +00:00
|
|
|
ETag string
|
2020-01-21 21:36:42 +00:00
|
|
|
}
|
2023-12-15 14:16:01 +00:00
|
|
|
|
|
|
|
type CopyOptions struct {
|
|
|
|
NoRecursive bool
|
|
|
|
NoOverwrite bool
|
|
|
|
}
|
2024-01-18 12:25:14 +00:00
|
|
|
|
|
|
|
type MoveOptions struct {
|
|
|
|
NoOverwrite bool
|
|
|
|
}
|
2024-01-18 12:37:21 +00:00
|
|
|
|
|
|
|
// ConditionalMatch represents the value of a conditional header
|
|
|
|
// according to RFC 2068 section 14.25 and RFC 2068 section 14.26
|
|
|
|
// The (optional) value can either be a wildcard or an ETag.
|
|
|
|
type ConditionalMatch string
|
|
|
|
|
|
|
|
func (val ConditionalMatch) IsSet() bool {
|
|
|
|
return val != ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (val ConditionalMatch) IsWildcard() bool {
|
|
|
|
return val == "*"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (val ConditionalMatch) ETag() (string, error) {
|
|
|
|
var e internal.ETag
|
|
|
|
if err := e.UnmarshalText([]byte(val)); err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return string(e), nil
|
|
|
|
}
|