Close pipes on file writer error (#21900)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f3e8a0b72f
Коммит
bef1f1cf60
@@ -824,6 +824,7 @@ func (t *UploadFileTask) postprocessImage(file io.Reader) {
|
|||||||
_, aerr := t.writeFile(r, path)
|
_, aerr := t.writeFile(r, path)
|
||||||
if aerr != nil {
|
if aerr != nil {
|
||||||
mlog.Error("Unable to upload", mlog.String("path", path), mlog.Err(aerr))
|
mlog.Error("Unable to upload", mlog.String("path", path), mlog.Err(aerr))
|
||||||
|
r.CloseWithError(aerr) // always returns nil
|
||||||
return
|
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 {
|
if fileErr := a.RemoveFile(tmpPath); fileErr != nil {
|
||||||
mlog.Warn("Failed to remove file", mlog.Err(fileErr))
|
mlog.Warn("Failed to remove file", mlog.Err(fileErr))
|
||||||
}
|
}
|
||||||
|
r.CloseWithError(err) // always returns nil
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user