From 426d0734d4bf98cd2f29a92cc016b3bd6c74421c Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Mon, 5 Dec 2016 15:10:29 -0800 Subject: [PATCH] Enforce image is treated as empty class Enforces backwards compatibility with older authorization servers without requiring the client to know about the compatibility requirements. Signed-off-by: Derek McGowan (github: dmcgowan) --- registry/client/auth/session.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/registry/client/auth/session.go b/registry/client/auth/session.go index d6d884ffd..3ca5e8b3e 100644 --- a/registry/client/auth/session.go +++ b/registry/client/auth/session.go @@ -155,7 +155,9 @@ type RepositoryScope struct { // using the scope grammar func (rs RepositoryScope) String() string { repoType := "repository" - if rs.Class != "" { + // Keep existing format for image class to maintain backwards compatibility + // with authorization servers which do not support the expanded grammar. + if rs.Class != "" && rs.Class != "image" { repoType = fmt.Sprintf("%s(%s)", repoType, rs.Class) } return fmt.Sprintf("%s:%s:%s", repoType, rs.Repository, strings.Join(rs.Actions, ","))