fix(crypt): premature close of MFile (#8132 close #8119)

* fix(crypt): premature close of MFile

* refactor
This commit is contained in:
j2rong4cn
2025-03-15 00:13:30 +08:00
committed by GitHub
parent 7579d44517
commit 0126af4de0
2 changed files with 10 additions and 4 deletions

View File

@ -282,8 +282,9 @@ func (d *Crypt) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (
if err != nil {
return nil, err
}
// 可以直接返回读取完也不会调用Close直到连接断开Close
return remoteLink.MFile, nil
//keep reuse same MFile and close at last.
remoteClosers.Add(remoteLink.MFile)
return io.NopCloser(remoteLink.MFile), nil
}
return nil, errs.NotSupport