Close pipes on file writer error (#21900)

Этот коммит содержится в:
Tim Scheuermann
2022-12-16 16:44:51 +01:00
коммит произвёл GitHub
родитель f3e8a0b72f
Коммит bef1f1cf60
2 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@@ -824,6 +824,7 @@ func (t *UploadFileTask) postprocessImage(file io.Reader) {
_, aerr := t.writeFile(r, path)
if aerr != nil {
mlog.Error("Unable to upload", mlog.String("path", path), mlog.Err(aerr))
r.CloseWithError(aerr) // always returns nil
return
}
}

Просмотреть файл

@@ -93,6 +93,7 @@ func (a *App) runPluginsHook(c request.CTX, info *model.FileInfo, file io.Reader
if fileErr := a.RemoveFile(tmpPath); fileErr != nil {
mlog.Warn("Failed to remove file", mlog.Err(fileErr))
}
r.CloseWithError(err) // always returns nil
return err
}