internal: add ETag
This commit is contained in:
@@ -2,7 +2,6 @@ package webdav
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -93,7 +92,7 @@ func (b *backend) HeadGet(w http.ResponseWriter, r *http.Request) error {
|
||||
w.Header().Set("Last-Modified", fi.ModTime.UTC().Format(http.TimeFormat))
|
||||
}
|
||||
if fi.ETag != "" {
|
||||
w.Header().Set("ETag", fmt.Sprintf("%q", fi.ETag))
|
||||
w.Header().Set("ETag", internal.ETag(fi.ETag).String())
|
||||
}
|
||||
|
||||
if rs, ok := f.(io.ReadSeeker); ok {
|
||||
@@ -174,7 +173,7 @@ func (b *backend) propfindFile(propfind *internal.Propfind, fi *FileInfo) (*inte
|
||||
|
||||
if fi.ETag != "" {
|
||||
props[internal.GetETagName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &internal.GetETag{ETag: fmt.Sprintf("%q", fi.ETag)}, nil
|
||||
return &internal.GetETag{ETag: internal.ETag(fi.ETag)}, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user