From 8b0d86f0502e6a8683a01d9c8ad7ce701b76dd9c Mon Sep 17 00:00:00 2001 From: swarajpande5 Date: Sun, 25 Aug 2024 15:04:56 +0530 Subject: [PATCH] [cleaner] Check if keyword exists in dataset before obfuscation Check whether item keyword exists in dataset before obfuscation in sanitize_item(self, item) method. Resolves redundant increments when the same keyword is provided more than once, and the current obfuscation "obfuscatedwordX" is preserved. Closes: #3745 Signed-off-by: swarajpande5 --- sos/cleaner/mappings/keyword_map.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sos/cleaner/mappings/keyword_map.py b/sos/cleaner/mappings/keyword_map.py index cbeb0c4e59..716c2716d1 100644 --- a/sos/cleaner/mappings/keyword_map.py +++ b/sos/cleaner/mappings/keyword_map.py @@ -25,6 +25,8 @@ class SoSKeywordMap(SoSMap): word_count = 0 def sanitize_item(self, item): + if item in self.dataset: + return self.dataset[item] _ob_item = f"obfuscatedword{self.word_count}" self.word_count += 1 if _ob_item in self.dataset.values():