Skip to content

Commit d126ec3

Browse files
committed
multipart: Remove variable
The variable is always true because we have zero part. It means we have the previous part even for the first part uploaded by a user. Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
1 parent 40b1ffd commit d126ec3

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

api/layer/multipart_upload.go

+5-10
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,10 @@ func (n *layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf
252252
}
253253

254254
var (
255-
splitPreviousID oid.ID
256-
splitFirstID oid.ID
257-
isSetSplitPreviousID bool
258-
multipartHash = sha256.New()
259-
tzHash hash.Hash
255+
splitPreviousID oid.ID
256+
splitFirstID oid.ID
257+
multipartHash = sha256.New()
258+
tzHash hash.Hash
260259
)
261260

262261
if n.neoFS.IsHomomorphicHashingEnabled() {
@@ -282,7 +281,6 @@ func (n *layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf
282281
}
283282
}
284283

285-
isSetSplitPreviousID = true
286284
splitPreviousID = lastPart.OID
287285

288286
if err = splitFirstID.DecodeString(multipartInfo.UploadID); err != nil {
@@ -318,9 +316,7 @@ func (n *layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf
318316
var totalBytes int
319317
// slice part manually. Simultaneously considering the part is a single object for user.
320318
for {
321-
if isSetSplitPreviousID {
322-
prm.Multipart.SplitPreviousID = &splitPreviousID
323-
}
319+
prm.Multipart.SplitPreviousID = &splitPreviousID
324320

325321
if !splitFirstID.Equals(oid.ID{}) {
326322
prm.Multipart.SplitFirstID = &splitFirstID
@@ -338,7 +334,6 @@ func (n *layer) uploadPart(ctx context.Context, multipartInfo *data.MultipartInf
338334
return nil, err
339335
}
340336

341-
isSetSplitPreviousID = true
342337
splitPreviousID = id
343338
elements = append(elements, data.LinkObjectPayload{OID: id, Size: uint32(nBts)})
344339
}

0 commit comments

Comments
 (0)