Merge pull request #3203 from ThomasWaldmann/fix-4args-open-1.1

fix server-side IndexError for 4-arg open() of old clients, fixes #3192
This commit is contained in:
TW 2017-10-22 02:21:41 +02:00 committed by GitHub
commit cb7a6252a3
1 changed files with 9 additions and 1 deletions

View File

@ -180,7 +180,15 @@ class RepositoryServer: # pragma: no cover
def positional_to_named(self, method, argv): def positional_to_named(self, method, argv):
"""Translate from positional protocol to named protocol.""" """Translate from positional protocol to named protocol."""
return {name: argv[pos] for pos, name in enumerate(compatMap[method])} try:
return {name: argv[pos] for pos, name in enumerate(compatMap[method])}
except IndexError:
if method == 'open' and len(argv) == 4:
# borg clients < 1.0.7 use open() with 4 args
mapping = compatMap[method][:4]
else:
raise
return {name: argv[pos] for pos, name in enumerate(mapping)}
def filter_args(self, f, kwargs): def filter_args(self, f, kwargs):
"""Remove unknown named parameters from call, because client did (implicitly) say it's ok.""" """Remove unknown named parameters from call, because client did (implicitly) say it's ok."""