<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu

from __future__ import (unicode_literals, absolute_import,
                        division, print_function)
import logging

from django.http import HttpResponse
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.static import serve

logger = logging.getLogger(__name__)


@login_required
def serve_protected_files(request, fpath=None):
    if settings.SERVE_PROTECTED_FILES:
        return serve(request, fpath, settings.FILES_REPOSITORY, True)

    response = HttpResponse()
    del response['content-type']
    response['X-Accel-Redirect'] = "{protected_url}/{fpath}".format(
        protected_url=settings.FILES_REPOSITORY_URL_PATH,
        fpath=fpath)
    return response<commit_msg>fixing content-type issue with nginx<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu

from __future__ import (unicode_literals, absolute_import,
                        division, print_function)
import logging

from django.http import HttpResponse
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.static import serve

logger = logging.getLogger(__name__)


@login_required
def serve_protected_files(request, fpath=None):
    if settings.SERVE_PROTECTED_FILES:
        return serve(request, fpath, settings.FILES_REPOSITORY, True)

    response = HttpResponse()
    response['Content-Type'] = ''
    response['X-Accel-Redirect'] = "{protected_url}/{fpath}".format(
        protected_url=settings.FILES_REPOSITORY_URL_PATH,
        fpath=fpath)
    return response
{'fraction_non_alphanumeric': 0.09730363423212192, 'fraction_numerical': 0.004689331770222743, 'mean_word_length': 4.126126126126126, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1656812', 'n_tokens_mistral': 525, 'n_tokens_neox': 505, 'n_words': 120}