File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 33from flask_jwt_extended import jwt_required
44
55from app .api .helpers .badge_forms import create_preivew_badge_pdf
6- from app .api .helpers .errors import ForbiddenError , NotFoundError
6+ from app .api .helpers .errors import ForbiddenError , NotFoundError , UnprocessableEntityError
77from app .api .helpers .export_helpers import (
88 comma_separated_params_to_list ,
99 create_export_badge_job ,
@@ -48,8 +48,14 @@ def print_badge_pdf():
4848 )
4949 attendee_id = request .args .get ('attendee_id' )
5050 list_field_show = comma_separated_params_to_list (request .args .get ('list_field_show' ))
51-
52- ticket_holder = TicketHolder .query .filter_by (id = attendee_id ).first ()
51+ if isinstance (attendee_id , int ) or (
52+ isinstance (attendee_id , str ) and attendee_id .isdigit ()
53+ ):
54+ ticket_holder = TicketHolder .query .filter_by (id = attendee_id ).first ()
55+ else :
56+ raise UnprocessableEntityError (
57+ {'pointer' : 'ticket_holder' }, "Invalid Attendee Id"
58+ )
5359 if ticket_holder is None :
5460 raise NotFoundError (
5561 {'source' : '' }, 'This ticket holder is not associated with any ticket'
You can’t perform that action at this time.
0 commit comments