Commit 224bf25f authored by Bui's avatar Bui Committed by GitHub

Merge pull request #224 from N-Field/patch-preview-int

fix 400 errors from /api/preview
parents f346e053 992a44be
......@@ -341,9 +341,10 @@ def route_admin_songs_id_delete(id):
@app.cache.cached(timeout=15, query_string=True)
def route_api_preview():
song_id = request.args.get('id', None)
if not song_id or not re.match('^[0-9]+$', song_id):
if not song_id or not re.match('^[0-9]{1,9}$', song_id):
abort(400)
song_id = int(song_id)
song = db.songs.find_one({'id': song_id})
if not song:
abort(400)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment