<commit_before>package ReseqTrack::ElasticsearchProxy;
use Mojo::Base 'Mojolicious';

sub startup {
    my ($self) = @_;

    $self->plugin('Config', file => $self->home->rel_file('config/elasticsearchproxy.conf'));

    if ($self->config('cors.enabled')) {
        $self->plugin('CORS');
    }

    if (my $static_directory = $self->config('static_directory')) {
        $self->plugin('Directory', root => $static_directory, dir_index => 'index.html',
            handler => sub {
                my ($controller, $path) = @_;
                if ($path =~ /\/index.html/) {
                    my $req_path = $controller->req->url->path->to_abs_string;
                    # permanent redirect to put a trailing slash on directories
                    if ($controller->req->url->path->to_abs_string !~ /\/index.html/ && $controller->req->url->path->trailing_slash->to_abs_string) {
                        $c->res->code(301);
                        return $controller->redirect_to($controller->req->url->path->trailing_slash(0)
                    }
                    # No caching allowed on index files in the static directory
                    $controller->res->headers->cache_control('max-age=1, no-cache');
                }
            },<commit_msg>bugfix<commit_after>package ReseqTrack::ElasticsearchProxy;
use Mojo::Base 'Mojolicious';

sub startup {
    my ($self) = @_;

    $self->plugin('Config', file => $self->home->rel_file('config/elasticsearchproxy.conf'));

    if ($self->config('cors.enabled')) {
        $self->plugin('CORS');
    }

    if (my $static_directory = $self->config('static_directory')) {
        $self->plugin('Directory', root => $static_directory, dir_index => 'index.html',
            handler => sub {
                my ($controller, $path) = @_;
                if ($path =~ /\/index.html/) {
                    my $req_path = $controller->req->url->path->to_abs_string;
                    # permanent redirect to put a trailing slash on directories
                    if ($controller->req->url->path->to_abs_string !~ /\/index.html/ && $controller->req->url->path->trailing_slash->to_abs_string) {
                        $controller->res->code(301);
                        return $controller->redirect_to($controller->req->url->path->trailing_slash(0)
                    }
                    # No caching allowed on index files in the static directory
                    $controller->res->headers->cache_control('max-age=1, no-cache');
                }
            },
{'fraction_non_alphanumeric': 0.1583531274742676, 'fraction_numerical': 0.00395882818685669, 'mean_word_length': 2.0556227327690446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 71, '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': '957283', 'n_tokens_mistral': 714, 'n_tokens_neox': 679, 'n_words': 126}