From 2db0c6c2622e59ac20833eba266a2229d8580e7e Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Wed, 12 Dec 2018 12:01:35 +0800 Subject: [PATCH] Explicitly stating utf-8 when fetching oauth token Fixes #2870 Signed-off-by: Eric Lin --- remotes/docker/authorizer.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/remotes/docker/authorizer.go b/remotes/docker/authorizer.go index e17628750..73adb5a2f 100644 --- a/remotes/docker/authorizer.go +++ b/remotes/docker/authorizer.go @@ -194,7 +194,11 @@ func (a *dockerAuthorizer) fetchTokenWithOAuth(ctx context.Context, to tokenOpti form.Set("password", to.secret) } - resp, err := ctxhttp.PostForm(ctx, a.client, to.realm, form) + resp, err := ctxhttp.Post( + ctx, a.client, to.realm, + "application/x-www-form-urlencoded; charset=utf-8", + strings.NewReader(form.Encode()), + ) if err != nil { return "", err }