Go: add context (#17314)

### Summary

As title.

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2026-07-24 16:47:12 +08:00
committed by GitHub
parent 008fa3e10e
commit bdfc3ada41
78 changed files with 1031 additions and 904 deletions

View File

@@ -116,8 +116,9 @@ func (h *AgentHandler) UploadAgentFile(c *gin.Context) {
// into the normal UploadInfos path. We replicate that with a
// guard that dispatches to UploadFromURL only when both
// conditions are met.
ctx := c.Request.Context()
if url := c.Query("url"); url != "" && len(files) == 1 {
uploaded, err := h.fileService.UploadFromURL(user.ID, url)
uploaded, err := h.fileService.UploadFromURL(ctx, user.ID, url)
if err != nil {
common.ResponseWithCodeData(c, common.CodeServerError, nil, err.Error())
return
@@ -132,7 +133,7 @@ func (h *AgentHandler) UploadAgentFile(c *gin.Context) {
return
}
results, err := h.fileService.UploadInfos(user.ID, files)
results, err := h.fileService.UploadInfos(ctx, user.ID, files)
if err != nil {
common.ResponseWithCodeData(c, common.CodeServerError, nil, err.Error())
return