Commit 979ae9aa authored by Alessio Caiazza's avatar Alessio Caiazza

Fix EXIF cleaning for S3 compatible Object Storage

When exiftool is already terminated, we no longer attempt to read from its stdout.

Related to: https://gitlab.com/gitlab-org/gitlab-workhorse/-/issues/233
parent 35bc8e7e
---
title: Fix EXIF cleaning for S3 compatible Object Storage
merge_request:
author:
type: fixed
......@@ -37,19 +37,24 @@ func NewCleaner(ctx context.Context, stdin io.Reader) (io.Reader, error) {
}
func (c *cleaner) Read(p []byte) (int, error) {
n, err := c.stdout.Read(p)
if err == io.EOF {
if waitErr := c.wait(); waitErr != nil {
log.WithContextFields(c.ctx, log.Fields{
"command": c.cmd.Args,
"stderr": c.stderr.String(),
"error": waitErr.Error(),
}).Print("exiftool command failed")
return n, ErrRemovingExif
select {
case <-c.waitDone:
return 0, io.EOF
default:
n, err := c.stdout.Read(p)
if err == io.EOF {
if waitErr := c.wait(); waitErr != nil {
log.WithContextFields(c.ctx, log.Fields{
"command": c.cmd.Args,
"stderr": c.stderr.String(),
"error": waitErr.Error(),
}).Print("exiftool command failed")
return n, ErrRemovingExif
}
}
}
return n, err
return n, err
}
}
func (c *cleaner) startProcessing(stdin io.Reader) error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment