summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--obnamlib/plugins/restore_plugin.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py
index b7944946..bf539b5f 100644
--- a/obnamlib/plugins/restore_plugin.py
+++ b/obnamlib/plugins/restore_plugin.py
@@ -33,6 +33,12 @@ class NoToError(obnamlib.ObnamError):
msg = 'The restore command wants a target set with --to'
+class RelativePathError(obnamlib.ObnamError):
+
+ msg = ("Restore of {filename} requested, but it is not an absolute path "
+ "(doesn't start with /)")
+
+
class RestoreErrors(obnamlib.ObnamError):
msg = '''There were errors when restoring
@@ -137,6 +143,10 @@ class RestorePlugin(obnamlib.ObnamPlugin):
logging.debug('restoring to %s', self.app.settings['to'])
logging.debug('restoring what: %s', repr(args))
+ if args:
+ for arg in args:
+ if not os.path.isabs(arg):
+ raise RelativePathError(filename=arg)
if not args:
logging.debug('no args given, so restoring everything')
args = ['/']