From fce57ad8ebe747246c22aa322b97293a012e5abc Mon Sep 17 00:00:00 2001
From: Simone Margaritelli <evilsocket@gmail.com>
Date: Fri, 8 Nov 2019 13:28:37 +0100
Subject: [PATCH] misc: small fix or general refactoring i did not bother
 commenting

---
 pwnagotchi/utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pwnagotchi/utils.py b/pwnagotchi/utils.py
index d168627..239e5e8 100644
--- a/pwnagotchi/utils.py
+++ b/pwnagotchi/utils.py
@@ -121,10 +121,10 @@ def load_config(args):
 
 def parse_max_size(s):
     parts = re.findall(r'(^\d+)([bBkKmMgG]?)', s)
-    if len(parts) != 1:
+    if len(parts) != 1 or len(parts[0]) != 2:
         raise Exception("can't parse %s as a max size" % s)
 
-    num, unit = parts[0][1]
+    num, unit = parts[0]
     num = int(num)
     unit = unit.lower()