Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Drop back to ASCII after all. :-( (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Sep 13, 2012
1 parent 05b185a commit 4baf6b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 4 additions & 3 deletions www/%participant_id/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@

function success(d)
{
window.location.href = "/" + encodeURI(d.participant_id) + "/";
window.location.href = "/" + encodeURIComponent(d.participant_id) + "/";
}
function error(e)
{
Expand All @@ -297,8 +297,9 @@
}
else
{
alert( "Sorry, something went wrong. :-( Try again "
+ "later?");
alert( "Sorry, something went wrong. Either you used "
+ "disallowed characters or something broke on "
+ "our end.");
}
}
jQuery.ajax(
Expand Down
11 changes: 10 additions & 1 deletion www/%participant_id/participant_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ from aspen import Response
from gittip import db
from psycopg2 import IntegrityError

ALLOWED_ASCII = set("0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
".,-_;:@ ")


# ========================================================================== ^L

if user.ANON:
Expand All @@ -18,8 +24,11 @@ new_participant_id = request.body['participant_id']
for i, c in enumerate(new_participant_id):
if i == 32:
raise Response(413) # Request Entity Too Large (more or less)
if ord(c) < 32:
elif ord(c) < 128 and c not in ALLOWED_ASCII:
raise Response(400) # Yeah, no.
elif c not in ALLOWED_ASCII:
raise Response(400) # XXX Burned by an Aspen bug. :`-(
# https://github.com/whit537/aspen/issues/102


# Persist
Expand Down

0 comments on commit 4baf6b7

Please sign in to comment.