From 750e8f47158fa23124a4a3f93da6d6aa13f974ff Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Wed, 16 Dec 2009 08:00:10 -0700 Subject: [PATCH] Fixed path escaping for tanks.wq --- tanks/lib/Pflanzarr.py | 4 ++-- tanks/www/submit.cgi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tanks/lib/Pflanzarr.py b/tanks/lib/Pflanzarr.py index ae0d985..5291faa 100644 --- a/tanks/lib/Pflanzarr.py +++ b/tanks/lib/Pflanzarr.py @@ -40,7 +40,7 @@ class Pflanzarr: tmpPlayers = os.listdir(self._playerDir) players = [] for p in tmpPlayers: - p = unquote(p) + p = unquote(p, safe='') if not (p.startswith('.') or p.endswith('#') or p.endswith('~'))\ and p in colors: players.append(p) @@ -401,7 +401,7 @@ class Pflanzarr: colors = {} for line in file: try: - team, passwd, color = map(unquote, line.split('\t')) + team, passwd, color = map(unquote, line.split('\t'),['']*3) colors[team] = '#%s' % color except: colors[team] = errorColor diff --git a/tanks/www/submit.cgi b/tanks/www/submit.cgi index ded20f7..a5e86e0 100755 --- a/tanks/www/submit.cgi +++ b/tanks/www/submit.cgi @@ -49,7 +49,7 @@ if team not in teams.teams: if passwd != teams.teams[team][0]: print('

Invalid password.

'); done() -path = os.path.join(Config.DATA_PATH, 'ai/players', quote(team) ) +path = os.path.join(Config.DATA_PATH, 'ai/players', quote(team, safe='') ) file = open(path, 'w') file.write(code) file.close()