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.
This commit is contained in:
pare
ac0edd022f
commit
365ebf3ad9
S'han modificat 1 arxius amb 2 adicions i 1 eliminacions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Referencia en una nova incidència