From ac2d5af359adbc9b16da830239a4eee53b691c02 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 16 Mar 2013 16:50:18 -0500 Subject: [PATCH] restore-cmd.py: make sure restore paths have at least two components. Reported-by: Tim Riemenschneider Signed-off-by: Rob Browning --- cmd/restore-cmd.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/restore-cmd.py b/cmd/restore-cmd.py index 43209b3..750b82f 100755 --- a/cmd/restore-cmd.py +++ b/cmd/restore-cmd.py @@ -31,6 +31,14 @@ def plog(s): qprogress(s) +def valid_restore_path(path): + path = os.path.normpath(path) + if path.startswith('/'): + path = path[1:] + if '/' in path: + return True + + def print_info(n, fullname): if stat.S_ISDIR(n.mode): verbose1('%s/' % fullname) @@ -231,6 +239,9 @@ if opt.outdir: ret = 0 for d in extra: + if not valid_restore_path(d): + add_error("ERROR: path %r doesn't include a branch and revision" % d) + continue path,name = os.path.split(d) try: n = top.lresolve(d) -- 2.39.2