Edgewall Software

Opened 9 years ago

Last modified 9 years ago

#12076 closed defect

resource_exists in trac.ticket.api should avoid database exceptions from invalid input — at Version 1

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.7
Component: ticket system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

Reported in th:#12253, the function resource_exists in trac.ticket.api raises an exception on PostgreSQL when resource.id is not an integer.

Perhaps we should simply try converting resource.id to an integer in resource_exists:

try:
   id_ = int(resource.id)
except ValueError:
   return False

Change History (1)

comment:1 by Ryan J Ollos, 9 years ago

Description: modified (diff)
Owner: set to Ryan J Ollos
Status: newassigned
Note: See TracTickets for help on using tickets.