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

Commit

Permalink
Don't let people clobber existing filenames (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Sep 13, 2012
1 parent 4baf6b7 commit 95b1ef7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions www/%participant_id/participant_id.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from aspen import Response
from gittip import db
from psycopg2 import IntegrityError
Expand All @@ -7,6 +9,7 @@ ALLOWED_ASCII = set("0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
".,-_;:@ ")

FILENAMES = os.listdir(website.www_root)

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

Expand All @@ -30,6 +33,9 @@ for i, c in enumerate(new_participant_id):
raise Response(400) # XXX Burned by an Aspen bug. :`-(
# https://github.com/whit537/aspen/issues/102

if new_participant_id in FILENAMES:
raise Response(400)


# Persist
# =======
Expand Down

0 comments on commit 95b1ef7

Please sign in to comment.