filemanager/manager: surface incomplete prepare-upload response instead of nil-deref

Signed-off-by: SAY-5 <say.apm35@gmail.com>
pull/3443/head
SAY-5 2 months ago
parent 5994f7864f
commit 6557195a4d

@ -406,6 +406,12 @@ func (m *manager) updateStateless(ctx context.Context, req *fs.UploadRequest, o
if err != nil {
return nil, fmt.Errorf("faield to prepare uplaod: %w", err)
}
// A successful upstream call may still return a response with nil Req or
// Session — observed when the master returned 502 mid-prepare (#3441) and
// crashed the slave on the next attribute access.
if res == nil || res.Req == nil || res.Session == nil {
return nil, fmt.Errorf("stateless prepare upload returned an incomplete response")
}
req.Props = res.Req.Props
if err := m.Upload(ctx, req, res.Session.Policy, res.Session); err != nil {

Loading…
Cancel
Save