Browse Source

support TTL when creating folders

related to https://github.com/seaweedfs/seaweedfs/discussions/4549
pull/4550/head
chrislu 2 years ago
parent
commit
0bffb3770f
  1. 5
      weed/server/filer_server_handlers_write_autochunk.go

5
weed/server/filer_server_handlers_write_autochunk.go

@ -40,7 +40,7 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r *
var md5bytes []byte var md5bytes []byte
if r.Method == "POST" { if r.Method == "POST" {
if r.Header.Get("Content-Type") == "" && strings.HasSuffix(r.URL.Path, "/") { if r.Header.Get("Content-Type") == "" && strings.HasSuffix(r.URL.Path, "/") {
reply, err = fs.mkdir(ctx, w, r)
reply, err = fs.mkdir(ctx, w, r, so)
} else { } else {
reply, md5bytes, err = fs.doPostAutoChunk(ctx, w, r, chunkSize, contentLength, so) reply, md5bytes, err = fs.doPostAutoChunk(ctx, w, r, chunkSize, contentLength, so)
} }
@ -303,7 +303,7 @@ func (fs *FilerServer) saveAsChunk(so *operation.StorageOption) filer.SaveDataAs
} }
} }
func (fs *FilerServer) mkdir(ctx context.Context, w http.ResponseWriter, r *http.Request) (filerResult *FilerPostResult, replyerr error) {
func (fs *FilerServer) mkdir(ctx context.Context, w http.ResponseWriter, r *http.Request, so *operation.StorageOption) (filerResult *FilerPostResult, replyerr error) {
// detect file mode // detect file mode
modeStr := r.URL.Query().Get("mode") modeStr := r.URL.Query().Get("mode")
@ -337,6 +337,7 @@ func (fs *FilerServer) mkdir(ctx context.Context, w http.ResponseWriter, r *http
Mode: os.FileMode(mode) | os.ModeDir, Mode: os.FileMode(mode) | os.ModeDir,
Uid: OS_UID, Uid: OS_UID,
Gid: OS_GID, Gid: OS_GID,
TtlSec: so.TtlSeconds,
}, },
} }

Loading…
Cancel
Save