@cache_control(max_age=86400)
def serve(request, name):
    pk, file_ext = os.path.splitext(name)
    try:
        pk = int(pk)
    except __HOLE__:
        raise Http404('Filename is not an integer')
    f = get_object_or_404(File, pk=pk)
    mimetype = mimetypes.guess_type(name)[0] or 'application/octet-stream'
    response = HttpResponse(base64.b64decode(f.content), mimetype=mimetype)
    response['Content-Length'] = f.size
    return response
dataset/ETHPy150Open bfirsh/django-database-files/database_files/views.py/serve