From 365ebf3ad9083922b3245f5f5528217759b37aac Mon Sep 17 00:00:00 2001 From: Robert Mock Date: Sun, 11 Feb 2018 15:30:58 -0800 Subject: Fix 500 from status_post capitalized visibilities The validator for the 'visibility' parameter lower()s it before verifying, but this means that "direct", "Direct", and "dIRECT" all pass validation. However, passing in 'Direct' (at least, to my instance) throws `mastodon.Mastodon.MastodonAPIError: ('Mastodon API returned error', 500, 'Internal Server Error', None)`. This corrects the parameter in-place. --- mastodon/Mastodon.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 874d925..8b7064f 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -929,7 +929,8 @@ class Mastodon: # Validate visibility parameter valid_visibilities = ['private', 'public', 'unlisted', 'direct', ''] - if params_initial['visibility'].lower() not in valid_visibilities: + params_initial['visibility'] = params_initial['visibility'].lower() + if params_initial['visibility'] not in valid_visibilities: raise ValueError('Invalid visibility value! Acceptable ' 'values are %s' % valid_visibilities) -- cgit v1.2.3