Merge pull request #151 from tonistiigi/session-compat

session: better backwards compatibility with old servers
docker-18.09
Akihiro Suda 2017-11-02 13:30:08 +09:00 committed by GitHub
commit 1515a2ea10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -68,14 +68,15 @@ func (sp *fsSyncProvider) handle(method string, stream grpc.ServerStream) error
opts, _ := metadata.FromContext(stream.Context()) // if no metadata continue with empty object
dirName := ""
name, ok := opts[keyDirName]
if !ok || len(name) != 1 {
return errors.New("no dir name in request")
if ok && len(name) > 0 {
dirName = name[0]
}
dir, ok := sp.dirs[name[0]]
dir, ok := sp.dirs[dirName]
if !ok {
return errors.Errorf("no access allowed to dir %q", name[0])
return errors.Errorf("no access allowed to dir %q", dirName)
}
var excludes []string