[sysadmin-bin] ftpadmin: only take first directory for uniq_dir check
- From: Olav Vitters <ovitters src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] ftpadmin: only take first directory for uniq_dir check
- Date: Wed, 15 Jun 2011 08:29:47 +0000 (UTC)
commit 5b63e3e9fcc0a0373cfa99e0b71c9cd47cee4e6c
Author: Olav Vitters <olav vitters nl>
Date: Wed Jun 15 10:29:24 2011 +0200
ftpadmin: only take first directory for uniq_dir check
Fixes bug 652600
ftpadmin | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 5e414f6..c999cf4 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -332,11 +332,12 @@ class TarInfo(BasicInfo):
self.file[os.path.basename(info.name)] = t.extractfile(info).readlines()
if file_count == 1:
- if info.isdir():
+ if '/' in info.name.lstrip('/'):
+ uniq_dir = "%s/" % info.name.lstrip('/').partition('/')[0]
+ elif info.isdir():
uniq_dir = "%s/" % info.name
- else:
- uniq_dir = "%s/" % os.path.dirname(info.name.replace("/",os.sep)) if "/" in info.name else None
- elif uniq_dir is not None and not info.name.startswith(uniq_dir):
+ elif uniq_dir is not None and not info.name.startswith(uniq_dir) and \
+ not ( info.isdir() and uniq_dir == '%s/' % info.name ):
uniq_dir = None
if progress:
dots_to_show = t.offset / self.BLOCKSIZE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]