aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Liu <liul.stone@gmail.com>2019-11-27 00:04:47 +0800
committerLei Liu <lei01.liu@horizon.ai>2019-11-27 13:57:29 +0800
commit2700ac6d1fb791bdb0fab83117967d1315006e6f (patch)
treebbdd9201c2c66864c8c431ef7f12761e652cffe1
parent5f6b360eb723ef91d8bb5a556a336e3b54b8a96e (diff)
downloadseaweedfs-2700ac6d1fb791bdb0fab83117967d1315006e6f.tar.xz
seaweedfs-2700ac6d1fb791bdb0fab83117967d1315006e6f.zip
filer: Add attr.mode in query string
Signed-off-by: Lei Liu <liul.stone@gmail.com>
-rw-r--r--weed/server/filer_server_handlers_write.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index 5d95a5d7e..f94d83347 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -149,6 +149,16 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
stats.FilerRequestHistogram.WithLabelValues("postStoreWrite").Observe(time.Since(start).Seconds())
}()
+ modeStr := r.URL.Query().Get("mode")
+ if modeStr == "" {
+ modeStr = "0660"
+ }
+ mode, err := strconv.ParseUint(modeStr, 8, 32)
+ if err != nil {
+ glog.Errorf("Invalid mode format: %s, use 0660 by default", modeStr)
+ mode = 0660
+ }
+
path := r.URL.Path
if strings.HasSuffix(path, "/") {
if ret.Name != "" {
@@ -165,7 +175,7 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
Attr: filer2.Attr{
Mtime: time.Now(),
Crtime: crTime,
- Mode: 0660,
+ Mode: os.FileMode(mode),
Uid: OS_UID,
Gid: OS_GID,
Replication: replication,