Skip to content

Exception thrown when Media Link field contains a link to an mp4 (and possibly other non-image links) #41

@anthonycats

Description

@anthonycats

Here's the traceback when trying to fetch the document in question:

Traceback (most recent call last):
  File "test.py", line 49, in <module>
    response = form.submit()
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 272, in submit
    request_handler=self.request_handler
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 350, in __init__
    self.documents = [Document(d) for d in data.get("results")]
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 350, in <listcomp>
    self.documents = [Document(d) for d in data.get("results")]
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 394, in __init__
    self.fragments[f_key] = Fragment.from_json(fragment_value)
  File "/usr/local/lib/python3.7/site-packages/prismic/fragments.py", line 52, in from_json
    return f_type(data.get("value"))
  File "/usr/local/lib/python3.7/site-packages/prismic/fragments.py", line 289, in __init__
    self.name = self.image.get("name")
AttributeError: 'NoneType' object has no attribute 'get'

Here's what the data in the field looks like:

"qwerty": {
  "type": "Link.file",
   "value": {
    "file": {
      "name": "1514560395-definitivehairydairycow.mp4",
      "kind": "document",
      "url": "https://redacted.prismic.io/redacted%2F94ff171b-ec65-4867-a0fb-1fa97f2b1bda_1514560395-definitivehairydairycow.mp4",
      "size": "129914"
    }
  }
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions