X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/644f5de63e2b8b02e054fcbb3e9af39560cffae3..7bfb9fd099ada6b7466ec3531caebbd5ac0970ba:/services/keep-web/webdav.go diff --git a/services/keep-web/webdav.go b/services/keep-web/webdav.go index 3ceb0ed5c9..af83681f9c 100644 --- a/services/keep-web/webdav.go +++ b/services/keep-web/webdav.go @@ -8,6 +8,7 @@ import ( "crypto/rand" "errors" "fmt" + "io" prand "math/rand" "os" "path" @@ -37,6 +38,12 @@ var ( type webdavFS struct { collfs arvados.CollectionFileSystem writing 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) { @@ -71,6 +78,9 @@ func (fs *webdavFS) OpenFile(ctx context.Context, name string, flag int, perm os // have 405. f = writeFailer{File: f, err: errReadOnly} } + if fs.alwaysReadEOF { + f = readEOF{File: f} + } return } @@ -106,6 +116,14 @@ func (wf writeFailer) Close() error { return wf.err } +type readEOF struct { + webdav.File +} + +func (readEOF) Read(p []byte) (int, error) { + return 0, io.EOF +} + // noLockSystem implements webdav.LockSystem by returning success for // every possible locking operation, even though it has no side // effects such as actually locking anything. This works for a