sos/backport-archive-normalise-dest_dir-in-FileCacheArchive._chec.patch

35 lines
1.0 KiB
Diff

From ca422720b74181b2433473428e29e90af59b3cf8 Mon Sep 17 00:00:00 2001
From: "Bryn M. Reeves" <bmr@redhat.com>
Date: Fri, 31 Aug 2018 12:55:51 +0100
Subject: [PATCH 0025/1146] [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>
---
sos/archive.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
--
2.26.0.windows.1