Merge pull request #12702 from LK4D4/good_ol_flushed
Return weird behaviour of returning json errors
This commit is contained in:
commit
1492a7d7fd
1 changed files with 6 additions and 2 deletions
|
@ -862,11 +862,12 @@ func (s *Server) postImagesPush(eng *engine.Engine, version version.Version, w h
|
|||
useJSON := version.GreaterThan("1.0")
|
||||
name := vars["name"]
|
||||
|
||||
output := utils.NewWriteFlusher(w)
|
||||
imagePushConfig := &graph.ImagePushConfig{
|
||||
MetaHeaders: metaHeaders,
|
||||
AuthConfig: authConfig,
|
||||
Tag: r.Form.Get("tag"),
|
||||
OutStream: utils.NewWriteFlusher(w),
|
||||
OutStream: output,
|
||||
Json: useJSON,
|
||||
}
|
||||
if useJSON {
|
||||
|
@ -874,8 +875,11 @@ func (s *Server) postImagesPush(eng *engine.Engine, version version.Version, w h
|
|||
}
|
||||
|
||||
if err := s.daemon.Repositories().Push(name, imagePushConfig); err != nil {
|
||||
if !output.Flushed() {
|
||||
return err
|
||||
}
|
||||
sf := streamformatter.NewStreamFormatter(useJSON)
|
||||
return fmt.Errorf(string(sf.FormatError(err)))
|
||||
output.Write(sf.FormatError(err))
|
||||
}
|
||||
return nil
|
||||
|
||||
|
|
Loading…
Reference in a new issue