1
0
mirror of https://github.com/etesync/server synced 2024-11-19 07:18:08 +00:00
etesync-server/django_etebase/parsers.py
Tom Hacohen 0585d6ee92 Chunk file uploader: accept all kinds of media types.
This restriction was unnecessary and annoying to deal with in clients.
2020-12-15 13:59:06 +02:00

15 lines
373 B
Python

from rest_framework.parsers import FileUploadParser
class ChunkUploadParser(FileUploadParser):
"""
Parser for chunk upload data.
"""
def get_filename(self, stream, media_type, parser_context):
"""
Detects the uploaded file name.
"""
view = parser_context["view"]
return parser_context["kwargs"][view.lookup_field]