(c *gin.Context)
| 412 | } |
| 413 | |
| 414 | func (dr *driveRoute) writeContent(c *gin.Context) { |
| 415 | path := utils.CleanPath(c.Param("path")) |
| 416 | d := c.MustGet("drive").(types.IDrive) |
| 417 | |
| 418 | principal := GetPrincipal(c) |
| 419 | override := utils.ToBool(c.Query("override")) |
| 420 | defer func() { _ = c.Request.Body.Close() }() |
| 421 | tempFile, size, e := ReadRequestBodyToTempFile(c, dr.config.TempDir) |
| 422 | if e != nil { |
| 423 | _ = c.Error(e) |
| 424 | return |
| 425 | } |
| 426 | t, e := dr.runner.ExecuteAndWait(func(ctx types.TaskCtx) (any, error) { |
| 427 | defer func() { |
| 428 | _ = tempFile.Close() |
| 429 | _ = os.Remove(tempFile.Name()) |
| 430 | }() |
| 431 | r, e := d.Save(ctx, path, size, override, tempFile) |
| 432 | if e != nil { |
| 433 | return nil, e |
| 434 | } |
| 435 | return dr.newEntryJson(r, principal), nil |
| 436 | }, 2*time.Second, task.WithNameGroup(path, "drive/write")) |
| 437 | if e != nil { |
| 438 | _ = c.Error(e) |
| 439 | return |
| 440 | } |
| 441 | SetResult(c, t) |
| 442 | } |
| 443 | |
| 444 | func (dr *driveRoute) chunkUploadRequest(c *gin.Context) { |
| 445 | size := utils.ToInt64(c.Query("size"), -1) |
nothing calls this directly
no test coverage detected