diff options
author | Robert Mock <[email protected]> | 2018-02-11 15:30:58 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2018-02-11 15:30:58 -0800 |
commit | 365ebf3ad9083922b3245f5f5528217759b37aac (patch) | |
tree | c12578b9ede8252d67c332a33d9721b81f989afe /mastodon | |
parent | ac0edd022fef41c2dcb8a8b8186cda13745dcd79 (diff) | |
download | mastodon.py-365ebf3ad9083922b3245f5f5528217759b37aac.tar.gz |
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.
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 3 |
1 files changed, 2 insertions, 1 deletions
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: | |||
929 | 929 | ||
930 | # Validate visibility parameter | 930 | # Validate visibility parameter |
931 | valid_visibilities = ['private', 'public', 'unlisted', 'direct', ''] | 931 | valid_visibilities = ['private', 'public', 'unlisted', 'direct', ''] |
932 | if params_initial['visibility'].lower() not in valid_visibilities: | 932 | params_initial['visibility'] = params_initial['visibility'].lower() |
933 | if params_initial['visibility'] not in valid_visibilities: | ||
933 | raise ValueError('Invalid visibility value! Acceptable ' | 934 | raise ValueError('Invalid visibility value! Acceptable ' |
934 | 'values are %s' % valid_visibilities) | 935 | 'values are %s' % valid_visibilities) |
935 | 936 | ||