From e0c3716e08f16f869f15cd02ac45deb5efdbcdcd Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Wed, 13 Mar 2019 20:55:18 -0600 Subject: [PATCH] Avoid crash if fstype is None * Set fstype to 'UNKNOWN FS' if it's an empty string or None * Ensure all v_data values are strings before replacing text * Fixes issue #53 (again) --- .bin/Scripts/functions/osticket.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bin/Scripts/functions/osticket.py b/.bin/Scripts/functions/osticket.py index 8e011c55..ae6c67be 100644 --- a/.bin/Scripts/functions/osticket.py +++ b/.bin/Scripts/functions/osticket.py @@ -248,6 +248,10 @@ class osTicket(): # Ensure string type label = '' fstype = v_data.get('fstype', 'UNKNOWN FS') + if not fstype: + # Either empty string or None + fstype = 'UNKNOWN FS' + fstype = str(fstype).upper() size = v_data.get('size', '') if size: size = '{} {}B'.format(size[:-1], size[-1:]).upper() @@ -256,6 +260,7 @@ class osTicket(): size_used = v_data.get('size_used', 'UNKNOWN').upper() size_avail = v_data.get('size_avail', 'UNKNOWN').upper() v_data = [v_path, label, size, fstype, size_used, size_avail] + v_data = [str(v) for v in v_data] v_data = [v.strip().replace(' ', '_') for v in v_data] for i in range(len(v_data)): pad = 8