b72d26
From bc650cd161548159e551ddc201596bf19b1865d0 Mon Sep 17 00:00:00 2001
b72d26
From: Pavel Moravec <pmoravec@redhat.com>
b72d26
Date: Fri, 27 Jul 2018 08:56:37 +0200
b72d26
Subject: [PATCH] [policies] sanitize report label
b72d26
b72d26
similarly like we sanitize case id, we should sanitize report label
b72d26
to e.g. exclude spaces from final tarball name.
b72d26
b72d26
Resolves: #1389
b72d26
b72d26
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
b72d26
---
b72d26
 sos/policies/__init__.py | 9 +++------
b72d26
 1 file changed, 3 insertions(+), 6 deletions(-)
b72d26
b72d26
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
b72d26
index 7b301dec..65d8aac6 100644
b72d26
--- a/sos/policies/__init__.py
b72d26
+++ b/sos/policies/__init__.py
b72d26
@@ -408,7 +408,7 @@ No changes will be made to system configuration.
b72d26
             date=date,
b72d26
             rand=rand
b72d26
         )
b72d26
-        return time.strftime(nstr)
b72d26
+        return self.sanitize_filename(time.strftime(nstr))
b72d26
 
b72d26
     # for some specific binaries like "xz", we need to determine package
b72d26
     # providing it; that is policy specific. By default return the binary
b72d26
@@ -726,8 +726,8 @@ class LinuxPolicy(Policy):
b72d26
         """Returns the name usd in the pre_work step"""
b72d26
         return self.host_name()
b72d26
 
b72d26
-    def sanitize_case_id(self, case_id):
b72d26
-        return re.sub(r"[^-a-z,A-Z.0-9]", "", case_id)
b72d26
+    def sanitize_filename(self, name):
b72d26
+        return re.sub(r"[^-a-z,A-Z.0-9]", "", name)
b72d26
 
b72d26
     def lsmod(self):
b72d26
         """Return a list of kernel module names as strings.
b72d26
@@ -755,9 +755,6 @@ class LinuxPolicy(Policy):
b72d26
         if cmdline_opts.case_id:
b72d26
             self.case_id = cmdline_opts.case_id
b72d26
 
b72d26
-        if self.case_id:
b72d26
-            self.case_id = self.sanitize_case_id(self.case_id)
b72d26
-
b72d26
         return
b72d26
 
b72d26
 
b72d26
-- 
b72d26
2.17.1
b72d26