Skip to content
Snippets Groups Projects
Commit 74bd0bae authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch 'fail-graciously-on-empty-media-type' into 'develop'

Fail graciously when AP representation includes a null_value for mediaType

See merge request funkwhale/funkwhale!135
parents 410d5f1d c29a96f2
No related branches found
No related tags found
No related merge requests found
......@@ -708,23 +708,7 @@ class AudioSerializer(serializers.Serializer):
except (KeyError, TypeError):
raise serializers.ValidationError('Missing mediaType')
if not media_type.startswith('audio/'):
raise serializers.ValidationError('Invalid mediaType')
return url
def validate_url(self, v):
try:
url = v['href']
except (KeyError, TypeError):
raise serializers.ValidationError('Missing href')
try:
media_type = v['mediaType']
except (KeyError, TypeError):
raise serializers.ValidationError('Missing mediaType')
if not media_type.startswith('audio/'):
if not media_type or not media_type.startswith('audio/'):
raise serializers.ValidationError('Invalid mediaType')
return v
......
Fail graciously when AP representation includes a null_value for mediaType
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment