<commit_before>package main

import (
	"encoding/json"
	"fmt"
	shrinklink "github.com/cshenoy/shrinklink/shrinklink"
	"github.com/julienschmidt/httprouter"
	"io"
	"log"
	"net/http"
	"os"
)

type Error struct {
	Code    int    `json:"status_code"`
	Message string `json:"message"`
}

func createHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	var link shrinklink.UrlPayload
	log.Println(request.Body == nil)
	// THIS IS WRONG. DO NOT USE IN PROD
	if request.ContentLength == 0 {
		// http.Error(responseWriter, "Please send a request body", 400)
		thisErr := Error{400, "Body missing or malformed"}
		// http.Error(w, err, http.StatusBadRequest)
		responseWriter.Header().Set("Content-Type", "application/json")
		responseWriter.WriteHeader(thisErr.Code)
		json.NewEncoder(responseWriter).Encode(thisErr)
		// http.Error(responseWriter, thisErr.Message, http.StatusBadRequest)
		return
	}
	err := json.NewDecoder(request.Body).Decode(&link)
	log.Println(err, err == io.EOF)
	if err != nil {
		http.Error(responseWriter, err.Error(), 400)
		return
	}
	log.Println(link)
}

func findHandler(responseWriter http.ResponseWriter, request *http.Request, ps httprouter.Params) {
	log.Println("sup dawg", ps.ByName("hash"))
	fmt.Fprintf(responseWriter, "%s", ps.ByName("hash"))
	// CheckHash
	// If good -> redirect to long_url
	// If bad -> redirect to urbanstems.com
}

func indexHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	http.Redirect(responseWriter, request, "https://urbanstems.com", 301)
}

func indexHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	http.Redirect(responseWriter, request, "https://corp.urbanstems.com/blanc", 301)
}

func validToken(token string) bool {
	// return token == slashCommandToken()
	return true<commit_msg>removed https from blanc hardcode<commit_after>package main

import (
	"encoding/json"
	"fmt"
	shrinklink "github.com/cshenoy/shrinklink/shrinklink"
	"github.com/julienschmidt/httprouter"
	"io"
	"log"
	"net/http"
	"os"
)

type Error struct {
	Code    int    `json:"status_code"`
	Message string `json:"message"`
}

func createHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	var link shrinklink.UrlPayload
	log.Println(request.Body == nil)
	// THIS IS WRONG. DO NOT USE IN PROD
	if request.ContentLength == 0 {
		// http.Error(responseWriter, "Please send a request body", 400)
		thisErr := Error{400, "Body missing or malformed"}
		// http.Error(w, err, http.StatusBadRequest)
		responseWriter.Header().Set("Content-Type", "application/json")
		responseWriter.WriteHeader(thisErr.Code)
		json.NewEncoder(responseWriter).Encode(thisErr)
		// http.Error(responseWriter, thisErr.Message, http.StatusBadRequest)
		return
	}
	err := json.NewDecoder(request.Body).Decode(&link)
	log.Println(err, err == io.EOF)
	if err != nil {
		http.Error(responseWriter, err.Error(), 400)
		return
	}
	log.Println(link)
}

func findHandler(responseWriter http.ResponseWriter, request *http.Request, ps httprouter.Params) {
	log.Println("sup dawg", ps.ByName("hash"))
	fmt.Fprintf(responseWriter, "%s", ps.ByName("hash"))
	// CheckHash
	// If good -> redirect to long_url
	// If bad -> redirect to urbanstems.com
}

func indexHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	http.Redirect(responseWriter, request, "https://urbanstems.com", 301)
}

func blancHandler(responseWriter http.ResponseWriter, request *http.Request, _ httprouter.Params) {
	http.Redirect(responseWriter, request, "http://corp.urbanstems.com/blanc", 301)
}

func validToken(token string) bool {
	// return token == slashCommandToken()
	return true
{'fraction_non_alphanumeric': 0.13596374300186617, 'fraction_numerical': 0.008531058384430818, 'mean_word_length': 4.965023847376789, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 3, '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': '4371143', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1240, 'n_words': 269}