fix: return etag with md5 in webdav responses (#5158)

This commit is contained in:
Konstantin Lebedev
2024-01-03 21:50:32 +05:00
committed by GitHub
parent d3688938d9
commit b832ddd1ef
2 changed files with 14 additions and 0 deletions

View File

@@ -96,6 +96,7 @@ type FileInfo struct {
size int64
mode os.FileMode
modifiedTime time.Time
etag string
isDirectory bool
}
@@ -106,6 +107,10 @@ func (fi *FileInfo) ModTime() time.Time { return fi.modifiedTime }
func (fi *FileInfo) IsDir() bool { return fi.isDirectory }
func (fi *FileInfo) Sys() interface{} { return nil }
func (fi *FileInfo) ETag(ctx context.Context) (string, error) {
return fi.etag, nil
}
type WebDavFile struct {
fs *WebDavFileSystem
name string
@@ -369,6 +374,7 @@ func (fs *WebDavFileSystem) stat(ctx context.Context, fullFilePath string) (os.F
fi.name = string(fullpath)
fi.mode = os.FileMode(entry.Attributes.FileMode)
fi.modifiedTime = time.Unix(entry.Attributes.Mtime, 0)
fi.etag = filer.ETag(entry)
fi.isDirectory = entry.IsDirectory
if fi.name == "/" {