serve webdav: make Content-Type without reading the file and add --etag-hash
Before this change x/net/webdav would open each file to find out its Content-Type. Now we override the FileInfo and provide that directly from rclone. An --etag-hash has also been implemented to override the ETag with the hash passed in. Fixes #2273
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"github.com/ncw/rclone/cmd/serve/httplib"
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/net/webdav"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -23,6 +24,13 @@ const (
|
||||
testURL = "http://" + testBindAddress + "/"
|
||||
)
|
||||
|
||||
// check interfaces
|
||||
var (
|
||||
_ os.FileInfo = FileInfo{nil}
|
||||
_ webdav.ETager = FileInfo{nil}
|
||||
_ webdav.ContentTyper = FileInfo{nil}
|
||||
)
|
||||
|
||||
// TestWebDav runs the webdav server then runs the unit tests for the
|
||||
// webdav remote against it.
|
||||
func TestWebDav(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user