"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
serve webdav: fix error: Expecting fs.Object or fs.Directory, got <nil>
Nick Craig-Wood29b1751d0eb9
diff --git a/cmd/serve/webdav/webdav.go b/cmd/serve/webdav/webdav.goindex 0af46ec4d..ae8c4f2d1 100644--- a/cmd/serve/webdav/webdav.go+++ b/cmd/serve/webdav/webdav.go@@ -6,8 +6,10 @@ import ("encoding/xml""errors""fmt"+ "mime""net/http""os"+ "path""strconv""strings""time"@@ -580,12 +582,14 @@ func (fi FileInfo) ContentType(ctx context.Context) (contentType string, err errfs.Errorf(fi, "Expecting vfs.Node, got %T", fi.FileInfo)return "application/octet-stream", nil}- entry := node.DirEntry()+ entry := node.DirEntry() // can be nilswitch x := entry.(type) {case fs.Object:return fs.MimeType(ctx, x), nilcase fs.Directory:return "inode/directory", nil+ case nil:+ return mime.TypeByExtension(path.Ext(node.Name())), nil}fs.Errorf(fi, "Expecting fs.Object or fs.Directory, got %T", entry)return "application/octet-stream", nil