diff options
| author | chrislu <chris.lu@gmail.com> | 2022-12-19 11:32:00 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-12-19 11:32:00 -0800 |
| commit | f9fb3cd1fc81a3dddbb63bdec834b29fea53d7b5 (patch) | |
| tree | 7c5b256cc5b492e10b4a990c04eb0b932087f152 /weed | |
| parent | 6c7fe40305fdebe0902e44ae2a841ca4382b6a9b (diff) | |
| parent | a1ffa03d75c7e87950f9369ad16c21da81d56bc8 (diff) | |
| download | seaweedfs-f9fb3cd1fc81a3dddbb63bdec834b29fea53d7b5.tar.xz seaweedfs-f9fb3cd1fc81a3dddbb63bdec834b29fea53d7b5.zip | |
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/command/webdav.go | 5 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_multipart_handlers.go | 2 | ||||
| -rw-r--r-- | weed/s3api/tags.go | 6 | ||||
| -rw-r--r-- | weed/server/webdav_server.go | 12 |
4 files changed, 21 insertions, 4 deletions
diff --git a/weed/command/webdav.go b/weed/command/webdav.go index ea19ad1a7..987fc388e 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 *string port *int collection *string replication *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/s3api/s3api_object_multipart_handlers.go b/weed/s3api/s3api_object_multipart_handlers.go index b08a1e797..24d7656b5 100644 --- a/weed/s3api/s3api_object_multipart_handlers.go +++ b/weed/s3api/s3api_object_multipart_handlers.go @@ -121,7 +121,7 @@ func (s3a *S3ApiServer) AbortMultipartUploadHandler(w http.ResponseWriter, r *ht glog.V(2).Info("AbortMultipartUploadHandler", string(s3err.EncodeXMLResponse(response))) //https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html - s3err.WriteXMLResponse(w, r, http.StatusNoContent, response) + s3err.WriteEmptyResponse(w, r, http.StatusNoContent) s3err.PostLog(r, http.StatusNoContent, s3err.ErrNone) } diff --git a/weed/s3api/tags.go b/weed/s3api/tags.go index 0fc32241f..3df44fae0 100644 --- a/weed/s3api/tags.go +++ b/weed/s3api/tags.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/seaweedfs/seaweedfs/weed/util" "regexp" + "sort" "strings" ) @@ -39,6 +40,11 @@ func FromTags(tags map[string]string) (t *Tagging) { Value: v, }) } + if tagArr := t.TagSet.Tag; len(tagArr) > 0 { + sort.SliceStable(tagArr, func(i, j int) bool { + return tagArr[i].Key < tagArr[j].Key + }) + } return } 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) |
