<commit_before>package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"regexp"

	"github.com/gojp/goreportcard/handlers"
)

func makeHandler(name string, fn func(http.ResponseWriter, *http.Request, string, string)) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		validPath := regexp.MustCompile(fmt.Sprintf(`^/%s/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_.]+)$`, name))

		m := validPath.FindStringSubmatch(r.URL.Path)

		if m == nil {
			http.NotFound(w, r)
			return
		}

		// catch the special period cases that github does not allow for repos
		if len(m) > 2 && (m[2] == "." || m[2] == "..") {
			http.NotFound(w, r)
			return
		}

		fn(w, r, m[1], m[2])
	}
}<commit_msg>looks like m[2] is always valid at this point, removing extra len() check<commit_after>package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"regexp"

	"github.com/gojp/goreportcard/handlers"
)

func makeHandler(name string, fn func(http.ResponseWriter, *http.Request, string, string)) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		validPath := regexp.MustCompile(fmt.Sprintf(`^/%s/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_.]+)$`, name))

		m := validPath.FindStringSubmatch(r.URL.Path)

		if m == nil {
			http.NotFound(w, r)
			return
		}

		// catch the special period cases that github does not allow for repos
		if m[2] == "." || m[2] == ".." {
			http.NotFound(w, r)
			return
		}

		fn(w, r, m[1], m[2])
	}
}
{'fraction_non_alphanumeric': 0.19134078212290503, 'fraction_numerical': 0.012569832402234637, 'mean_word_length': 3.4365325077399382, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2151460', 'n_tokens_mistral': 626, 'n_tokens_neox': 565, 'n_words': 126}