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

Fail graciously when AP representation includes a null_value for mediaType

parent 410d5f1d
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