<commit_before>package warserver

import (
    "html/template"
    "warserver/logger"
    "net/http"
    "regexp"
)

// matches for urls which contain file name extensions, ie static files
var static_regex = regexp.MustCompile("/([^/]*\\.[^/]*)$"); 

func serveIndex(w http.ResponseWriter, r *http.Request) {
    // check for and process static file requests
    matches := static_regex.FindStringSubmatch(r.URL.Path)
    if (len(matches) > 0) {
        static_http.ServeHTTP(w, r)
        logger.Debugf("Static fetch for resource: %s", r.URL.Path)
    } else {
        // return the index.html
        t, err := template.ParseFiles("index.html")
        if (err != nil) {
            panic(err)
        }
        t.Execute(w, "")
        logger.Debug("Fetch for home page")<commit_msg>Block access to go sources from client<commit_after>package warserver

import (
    "html/template"
    "warserver/logger"
    "net/http"
    "regexp"
)

// matches for urls which contain file name extensions, ie static files
var static_regex = regexp.MustCompile("/assets/.*\\..*$");

func serveIndex(w http.ResponseWriter, r *http.Request) {
    // check for and process static file requests
    matches := static_regex.FindStringSubmatch(r.URL.Path)
    if (len(matches) > 0) {
        static_http.ServeHTTP(w, r)
        logger.Debugf("Static fetch for resource: %s", r.URL.Path)
    } else {
        // return the index.html
        t, err := template.ParseFiles("index.html")
        if (err != nil) {
            panic(err)
        }
        t.Execute(w, "")
        logger.Debug("Fetch for home page")
{'fraction_non_alphanumeric': 0.1360501567398119, 'fraction_numerical': 0.0012539184952978057, 'mean_word_length': 2.5704697986577183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5254804', 'n_tokens_mistral': 499, 'n_tokens_neox': 496, 'n_words': 129}