|
|
@ -130,6 +130,10 @@ func isAppend(r *http.Request) bool { |
|
|
|
return r.URL.Query().Get("op") == "append" |
|
|
|
} |
|
|
|
|
|
|
|
func needEnsureParentDirEntry(r *http.Request) bool { |
|
|
|
return r.Header.Get("ensureParentDir") != "false" |
|
|
|
} |
|
|
|
|
|
|
|
func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileName string, contentType string, so *operation.StorageOption, md5bytes []byte, fileChunks []*filer_pb.FileChunk, chunkOffset int64, content []byte) (filerResult *FilerPostResult, replyerr error) { |
|
|
|
|
|
|
|
// detect file mode
|
|
|
@ -243,7 +247,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil); dbErr != nil { |
|
|
|
if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil,needEnsureParentDirEntry(r)); dbErr != nil { |
|
|
|
replyerr = dbErr |
|
|
|
filerResult.Error = dbErr.Error() |
|
|
|
glog.V(0).Infof("failing to write %s to filer server : %v", path, dbErr) |
|
|
@ -320,7 +324,7 @@ func (fs *FilerServer) mkdir(ctx context.Context, w http.ResponseWriter, r *http |
|
|
|
Name: util.FullPath(path).Name(), |
|
|
|
} |
|
|
|
|
|
|
|
if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil); dbErr != nil { |
|
|
|
if dbErr := fs.filer.CreateEntry(ctx, entry, false, false, nil,true); dbErr != nil { |
|
|
|
replyerr = dbErr |
|
|
|
filerResult.Error = dbErr.Error() |
|
|
|
glog.V(0).Infof("failing to create dir %s on filer server : %v", path, dbErr) |
|
|
|