contentful.py icon indicating copy to clipboard operation
contentful.py copied to clipboard

KeyError when asset has no file

Open jeremydw opened this issue 9 years ago • 0 comments

Seems like if a user presses "Add Asset" but doesn't upload a file, serialization dies with a KeyError on a key named file here:

https://github.com/contentful-labs/contentful.py/blob/master/contentful/cda/serialization.py#L111

This corresponds to when a field in Contentful looks like this (added but not uploaded yet):

image

I think the correct behavior would be to return a resources.Asset but without a url or mimeType property. If this sounds right I can send a PR to update the behavior. Thanks for this library!

jeremydw avatar Jul 08 '16 23:07 jeremydw