Skip to content

AttributeError: 'NoneType' object has no attribute 'file' #100

@n1k0

Description

@n1k0

kinto-attachment 0.7.1, messing around with the API from js, managed to crash the server with some rotten request:

ERROR:kinto.core.views.errors:"POST  /v1/buckets/custom/collections/plop/records/2f3473f9-8259-4cb3-9ec7-121d151e1a4f/attachment" ? (? ms) 'NoneType' object has no attribute 'file' agent=node-fetch/1.0 (+https://github.com/bitinn/node-fetch) authn_type=basicauth collection_id=record collection_timestamp=1468484695624 errno=110 exception=Traceback (most recent call last):
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/tweens.py", line 22, in excview_tween
    response = handler(request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 101, in tm_tween
    reraise(*exc_info)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid_tm/compat.py", line 15, in reraise
    raise value
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid_tm/__init__.py", line 83, in tm_tween
    response = handler(request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/router.py", line 158, in handle_request
    view_name
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/view.py", line 547, in _call_view
    response = view_callable(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/config/views.py", line 182, in __call__
    return view(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/viewderivers.py", line 393, in attr_view
    return view(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/viewderivers.py", line 371, in predicate_wrapper
    return view(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/viewderivers.py", line 302, in _secured_view
    return view(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/viewderivers.py", line 442, in rendered_view
    result = view(context, request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/pyramid/viewderivers.py", line 147, in _requestonly_view
    response = view(request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/cornice/service.py", line 573, in wrapper
    response = view_(request)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/kinto_attachment/views/services.py", line 19, in attachment_post
    return post_attachment_view(request, SINGLE_FILE_FIELD)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/kinto_attachment/views/__init__.py", line 34, in post_attachment_view
    gzipped=gzipped)
  File "/home/niko/work/kinto-http.js/.venv/lib/python3.5/site-packages/kinto_attachment/utils.py", line 126, in save_file
    content.file.seek(0)
AttributeError: 'NoneType' object has no attribute 'file' lang=None uid=a9d81e1b56f2b77103e87601621a99b3d82a15abf7c72ce57a032d0964317c7a

I unfortunately can't provide a curl/httpie command for reproducing as fetch doesn't expose such a feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleFor marking issues as stale. Labeled issues will be closed soon if label is not removed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions