Merge pull request #2095 from dmcgowan/enforce-class-backward-compatibility

Enforce image is treated as empty class
This commit is contained in:
Derek McGowan 2016-12-07 14:28:13 -08:00 committed by GitHub
commit 844b92879f

View file

@ -155,7 +155,9 @@ type RepositoryScope struct {
// using the scope grammar // using the scope grammar
func (rs RepositoryScope) String() string { func (rs RepositoryScope) String() string {
repoType := "repository" 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) repoType = fmt.Sprintf("%s(%s)", repoType, rs.Class)
} }
return fmt.Sprintf("%s:%s:%s", repoType, rs.Repository, strings.Join(rs.Actions, ",")) return fmt.Sprintf("%s:%s:%s", repoType, rs.Repository, strings.Join(rs.Actions, ","))