mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 00:37:57 +08:00
Merge pull request #1140 from iliul/add-attr-mode
filer: Add attr.mode in query string
This commit is contained in:
@@ -149,6 +149,16 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
|
|||||||
stats.FilerRequestHistogram.WithLabelValues("postStoreWrite").Observe(time.Since(start).Seconds())
|
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
|
path := r.URL.Path
|
||||||
if strings.HasSuffix(path, "/") {
|
if strings.HasSuffix(path, "/") {
|
||||||
if ret.Name != "" {
|
if ret.Name != "" {
|
||||||
@@ -165,7 +175,7 @@ func (fs *FilerServer) updateFilerStore(ctx context.Context, r *http.Request, w
|
|||||||
Attr: filer2.Attr{
|
Attr: filer2.Attr{
|
||||||
Mtime: time.Now(),
|
Mtime: time.Now(),
|
||||||
Crtime: crTime,
|
Crtime: crTime,
|
||||||
Mode: 0660,
|
Mode: os.FileMode(mode),
|
||||||
Uid: OS_UID,
|
Uid: OS_UID,
|
||||||
Gid: OS_GID,
|
Gid: OS_GID,
|
||||||
Replication: replication,
|
Replication: replication,
|
||||||
|
Reference in New Issue
Block a user