Skip to content

Commit 8e08d51

Browse files
authored
Revert "Hack around DockerHub plugin scope handling" (#1531)
This reverts commit 46031f6.
1 parent 5ad0a76 commit 8e08d51

1 file changed

Lines changed: 1 addition & 26 deletions

File tree

pkg/v1/remote/descriptor.go

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -209,28 +209,6 @@ func (d *Descriptor) remoteIndex() *remoteIndex {
209209
}
210210
}
211211

212-
// https://github.com/docker/hub-feedback/issues/2107#issuecomment-1371293316
213-
//
214-
// DockerHub supports plugins, which look like normal manifests, but will
215-
// return a 401 with an incorrect challenge if you attempt to fetch them.
216-
//
217-
// They require you send, e.g.:
218-
// 'repository(plugin):vieux/sshfs:pull' not 'repository:vieux/sshfs:pull'.
219-
//
220-
// Hack around this by always including the plugin-ified version in the initial
221-
// scopes. The request will succeed with the correct subset, so it is safe to
222-
// have extraneous scopes here.
223-
func fixPluginScopes(ref name.Reference, scopes []string) []string {
224-
if ref.Context().Registry.String() == name.DefaultRegistry {
225-
for _, scope := range scopes {
226-
if strings.HasPrefix(scope, "repository") {
227-
scopes = append(scopes, strings.Replace(scope, "repository", "repository(plugin)", 1))
228-
}
229-
}
230-
}
231-
return scopes
232-
}
233-
234212
// fetcher implements methods for reading from a registry.
235213
type fetcher struct {
236214
Ref name.Reference
@@ -239,10 +217,7 @@ type fetcher struct {
239217
}
240218

241219
func makeFetcher(ref name.Reference, o *options) (*fetcher, error) {
242-
scopes := []string{ref.Scope(transport.PullScope)}
243-
scopes = fixPluginScopes(ref, scopes)
244-
245-
tr, err := transport.NewWithContext(o.context, ref.Context().Registry, o.auth, o.transport, scopes)
220+
tr, err := transport.NewWithContext(o.context, ref.Context().Registry, o.auth, o.transport, []string{ref.Scope(transport.PullScope)})
246221
if err != nil {
247222
return nil, err
248223
}

0 commit comments

Comments
 (0)