mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid possible runtime error: index out of range [0] with length 0
This commit is contained in:
parent
da76af187f
commit
f1713c96ae
|
@ -159,7 +159,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
|
||||||
var mergedChunks []*filer_pb.FileChunk
|
var mergedChunks []*filer_pb.FileChunk
|
||||||
|
|
||||||
isAppend := r.URL.Query().Get("op") == "append"
|
isAppend := r.URL.Query().Get("op") == "append"
|
||||||
isOffsetWrite := fileChunks[0].Offset > 0
|
isOffsetWrite := len(fileChunks) > 0 && fileChunks[0].Offset > 0
|
||||||
// when it is an append
|
// when it is an append
|
||||||
if isAppend || isOffsetWrite {
|
if isAppend || isOffsetWrite {
|
||||||
existingEntry, findErr := fs.filer.FindEntry(ctx, util.FullPath(path))
|
existingEntry, findErr := fs.filer.FindEntry(ctx, util.FullPath(path))
|
||||||
|
|
Loading…
Reference in a new issue