-
-
Notifications
You must be signed in to change notification settings - Fork 77
fix handling of number fields in jira plugin #73
Conversation
fixes getsentry/sentry-jira#108 in this repo |
elif schema['type'] == 'number': | ||
try: | ||
v = int(v) | ||
except ValueError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also raise a TypeError
if v
were None
or some other data structure entirely, so unless you're sure, I'd do except (TypeError, ValueError):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a check above for if v:
@@ -395,6 +395,11 @@ def create_issue(self, request, group, form_data, **kwargs): | |||
v = [v] | |||
elif schema.get('custom') == JIRA_CUSTOM_FIELD_TYPES.get('textarea'): | |||
v = v | |||
elif schema['type'] == 'number': | |||
try: | |||
v = int(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double check that this number
value won't work with floats. If it does, this will truncate them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@getsentry/plugins