h := webdav.Handler{
Prefix: "/" + strings.Join(pathParts[:stripParts], "/"),
FileSystem: &webdavFS{
- collfs: fs,
- writing: writeMethod[r.Method],
- reading: r.Method != "PROPFIND",
+ collfs: fs,
+ writing: writeMethod[r.Method],
+ alwaysReadEOF: r.Method == "PROPFIND",
},
LockSystem: h.webdavLS,
Logger: func(_ *http.Request, err error) {
type webdavFS struct {
collfs arvados.CollectionFileSystem
writing bool
- reading bool
+ // webdav PROPFIND reads the first few bytes of each file
+ // whose filename extension isn't recognized, which is
+ // prohibitively expensive: we end up fetching multiple 64MiB
+ // blocks. Avoid this by returning EOF on all reads when
+ // handling a PROPFIND.
+ alwaysReadEOF bool
}
func (fs *webdavFS) makeparents(name string) {
// have 405.
f = writeFailer{File: f, err: errReadOnly}
}
- if !fs.reading {
- // webdav PROPFIND reads the first few bytes of each
- // file whose filename extension isn't recognized,
- // which is prohibitively expensive: we end up
- // fetching multiple 64MiB blocks. Avoid this by
- // returning EOF on all reads when handling a
- // PROPFIND.
+ if fs.alwaysReadEOF {
f = readEOF{File: f}
}
return