SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
add -filer.path to webdav command (#4061)
lfhy038bab372607
diff --git a/weed/command/webdav.go b/weed/command/webdav.goindex ea19ad1a72..987fc388ec 100644--- a/weed/command/webdav.go+++ b/weed/command/webdav.go@@ -13,7 +13,7 @@ import ("github.com/seaweedfs/seaweedfs/weed/pb""github.com/seaweedfs/seaweedfs/weed/pb/filer_pb""github.com/seaweedfs/seaweedfs/weed/security"- "github.com/seaweedfs/seaweedfs/weed/server"+ weed_server "github.com/seaweedfs/seaweedfs/weed/server""github.com/seaweedfs/seaweedfs/weed/util")@@ -23,6 +23,7 @@ var (type WebDavOption struct {filer *string+ filerRootPath *stringport *intcollection *stringreplication *string@@ -44,6 +45,7 @@ func init() {webDavStandaloneOptions.tlsCertificate = cmdWebDav.Flag.String("cert.file", "", "path to the TLS certificate file")webDavStandaloneOptions.cacheDir = cmdWebDav.Flag.String("cacheDir", os.TempDir(), "local cache directory for file chunks")webDavStandaloneOptions.cacheSizeMB = cmdWebDav.Flag.Int64("cacheCapacityMB", 0, "local cache capacity in MB")+ webDavStandaloneOptions.filerRootPath = cmdWebDav.Flag.String("filer.path", "/", "use this remote path from filer server")}var cmdWebDav = &Command{@@ -104,6 +106,7 @@ func (wo *WebDavOption) startWebDav() bool {ws, webdavServer_err := weed_server.NewWebDavServer(&weed_server.WebDavOption{Filer: filerAddress,+ FilerRootPath: *wo.filerRootPath,GrpcDialOption: grpcDialOption,Collection: *wo.collection,Replication: *wo.replication,diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.goindex 58c47671f9..80b882181c 100644--- a/weed/server/webdav_server.go+++ b/weed/server/webdav_server.go@@ -26,6 +26,7 @@ import (type WebDavOption struct {Filer pb.ServerAddress+ FilerRootPath stringDomainName stringBucketsPath stringGrpcDialOption grpc.DialOption@@ -58,6 +59,11 @@ func NewWebDavServer(option *WebDavOption) (ws *WebDavServer, err error) {fs, _ := NewWebDavFileSystem(option)+ // Fix no set filer.path , accessing "/" returns "//"+ if option.FilerRootPath == "/" {+ option.FilerRootPath = ""+ }+ws = &WebDavServer{option: option,grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.filer"),@@ -195,7 +201,8 @@ func (fs *WebDavFileSystem) Mkdir(ctx context.Context, fullDirPath string, perm}func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, flag int, perm os.FileMode) (webdav.File, error) {-+ // Add filer.path+ fullFilePath = fs.option.FilerRootPath + fullFilePathglog.V(2).Infof("WebDavFileSystem.OpenFile %v %x", fullFilePath, flag)var err error@@ -367,7 +374,8 @@ func (fs *WebDavFileSystem) stat(ctx context.Context, fullFilePath string) (os.F}func (fs *WebDavFileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error) {-+ // Add filer.path+ name = fs.option.FilerRootPath + nameglog.V(2).Infof("WebDavFileSystem.Stat %v", name)return fs.stat(ctx, name)