diff options
| author | lfhy <821923589@qq.com> | 2022-12-18 12:07:02 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-17 20:07:02 -0800 |
| commit | 038bab372607822bb3000092ac8a247c00a94ccd (patch) | |
| tree | df4c60c487e64f9034282db973617a0abedf691d /weed/server/webdav_server.go | |
| parent | f84c13dabdef8790c193616fa36d46efc3791d24 (diff) | |
| download | seaweedfs-038bab372607822bb3000092ac8a247c00a94ccd.tar.xz seaweedfs-038bab372607822bb3000092ac8a247c00a94ccd.zip | |
add -filer.path to webdav command (#4061)
Diffstat (limited to 'weed/server/webdav_server.go')
| -rw-r--r-- | weed/server/webdav_server.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/weed/server/webdav_server.go b/weed/server/webdav_server.go index 58c47671f..80b882181 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 string DomainName string BucketsPath string GrpcDialOption 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 + fullFilePath glog.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 + name glog.V(2).Infof("WebDavFileSystem.Stat %v", name) return fs.stat(ctx, name) |
