From 556fa2f3ca894f9959777e9a87dfc8cce9e5691c Mon Sep 17 00:00:00 2001 From: lmk <1095689763@qq.com> Date: Wed, 27 May 2026 09:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0minio?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/video/concat_service.go | 2 +- service/video/cut_service.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service/video/concat_service.go b/service/video/concat_service.go index 04b551f..168a051 100644 --- a/service/video/concat_service.go +++ b/service/video/concat_service.go @@ -130,7 +130,7 @@ func (s *concatService) Concat(ctx context.Context, req *ConcatReq) (res *Concat // 如果需要上传到 MinIO(用独立 context,避免 HTTP 断开后 ctx 被取消) if req.Upload { - uploadCtx := context.Background() + uploadCtx := context.WithValue(context.Background(), "user", getUserFromCtx(ctx)) uploadRes, uploadErr := s.UploadToMinIO(uploadCtx, outputPath) if uploadErr != nil { return nil, fmt.Errorf("上传到MinIO失败: %v", uploadErr) diff --git a/service/video/cut_service.go b/service/video/cut_service.go index b1d03af..92a2001 100644 --- a/service/video/cut_service.go +++ b/service/video/cut_service.go @@ -192,9 +192,9 @@ func (s *cutService) Cut(ctx context.Context, req *CutReq) (res *CutRes, err err ShotsCount: len(validShots), } - // 如果需要上传到 MinIO + // 如果需要上传到 MinIO(用独立 context,避免 HTTP 断开后 ctx 被取消,同时保留用户信息) if req.Upload { - uploadCtx := context.Background() + uploadCtx := context.WithValue(context.Background(), "user", getUserFromCtx(ctx)) uploadRes, uploadErr := s.UploadToMinIO(uploadCtx, outputPath) if uploadErr != nil { return nil, fmt.Errorf("上传到MinIO失败: %v", uploadErr)