aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2018-08-31 12:55:51 +0100
committerBryn M. Reeves <bmr@redhat.com>2018-08-31 12:55:51 +0100
commitca422720b74181b2433473428e29e90af59b3cf8 (patch)
tree4e1215c0ac91859292510fc0cf60e28bda99930d
parentc496d2bec8cae175faf986567e73d16d401d8564 (diff)
downloadsos-ca422720b74181b2433473428e29e90af59b3cf8.tar.gz
[archive] normalise dest_dir in FileCacheArchive._check_path()
Always set a valid dest_dir in _check_path() and do not assume that it can be obtained by splitting the path: in the case of a directory it is the unmodified 'dest' value. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/archive.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sos/archive.py b/sos/archive.py
index ffa54036..903cc672 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -191,7 +191,10 @@ class FileCacheArchive(Archive):
copied now or `None` otherwise
"""
dest = dest or self.dest_path(src)
- dest_dir = os.path.split(dest)[0]
+ if path_type == P_DIR:
+ dest_dir = dest
+ else:
+ dest_dir = os.path.split(dest)[0]
if not dest_dir:
return dest