diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-10-21 19:30:45 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-10-21 19:30:45 +0100 |
commit | 5c02c00948259cf5d276ee0bc07f72d80b0d18b6 (patch) | |
tree | 7fcf7c73396cefedd2158160deca059542cd36db | |
parent | 45dd7c6089f7b09d1f8a85ee35f8cc179393cd54 (diff) | |
download | obnam-5c02c00948259cf5d276ee0bc07f72d80b0d18b6.tar.gz |
Fix trailing slash bug for "obnam ls"
Reported-by: Biltong
-rw-r--r-- | obnamlib/plugins/show_plugin.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/obnamlib/plugins/show_plugin.py b/obnamlib/plugins/show_plugin.py index 93aec835..b48f2534 100644 --- a/obnamlib/plugins/show_plugin.py +++ b/obnamlib/plugins/show_plugin.py @@ -157,9 +157,15 @@ class ShowPlugin(obnamlib.ObnamPlugin): self.app.output.write( 'Generation %s (%s - %s)\n' % (gen, started, ended)) for ls_file in args: + ls_file = self.remove_trailing_slashes(ls_file) self.show_objects(gen, ls_file) self.repo.fs.close() + def remove_trailing_slashes(self, filename): + while filename.endswith('/') and filename != '/': + filename = filename[:-1] + return filename + def format_time(self, timestamp): return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)) |