From d95bf30e5b113e5bb899bd58b76dfaec9402a7fb Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Mon, 4 May 2015 13:52:22 +0200 Subject: [PATCH] Admin page: Fix broken unban buttons on /banlist. --- admin_page_server.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/admin_page_server.py b/admin_page_server.py index 414d158..cce7ea6 100644 --- a/admin_page_server.py +++ b/admin_page_server.py @@ -124,12 +124,17 @@ class AdminPage(resource.Resource): request.setResponseCode(500) logger.log(logging.INFO,address+" Bad data "+gameid+" "+ipaddr) return "Bad data" + + # this strips the region identifier from game IDs, not sure if this actually always accurate but limited testing suggests it is + if len(gameid) > 3: + gameid = gameid[:-1] + if actiontype == 'ban': - dbconn.cursor().execute('insert into banned values(?,?)',(gameid[:-1],ipaddr)) - responsedata = "Added gameid=%s, ipaddr=%s" % (gameid[:-1],ipaddr) + dbconn.cursor().execute('insert into banned values(?,?)',(gameid,ipaddr)) + responsedata = "Added gameid=%s, ipaddr=%s" % (gameid,ipaddr) else: - dbconn.cursor().execute('delete from banned where gameid=? and ipaddr=?',(gameid[:-1],ipaddr)) - responsedata = "Removed gameid=%s, ipaddr=%s" % (gameid[:-1],ipaddr) + dbconn.cursor().execute('delete from banned where gameid=? and ipaddr=?',(gameid,ipaddr)) + responsedata = "Removed gameid=%s, ipaddr=%s" % (gameid,ipaddr) dbconn.commit() dbconn.close() logger.log(logging.INFO,address+" "+responsedata)