<commit_before>package main

import (
	"fmt"
	"image"
	"image/png"
	"log"
	"net/http"
	"os"
	"strings"

	// Load all the file formats
	_ "code.google.com/p/go.image/bmp"
	_ "code.google.com/p/go.image/tiff"
	_ "github.com/ftrvxmtrx/groke/image/pcx"
	_ "github.com/jeffallen/g/image/xbm"
	_ "github.com/knieriem/g/image/pnm"
	_ "github.com/mewrnd/blizzconv/images/cel"
	_ "github.com/mewrnd/blizzconv/images/cl2"
	_ "image/gif"
	_ "image/jpeg"
)

func convert(w http.ResponseWriter, r *http.Request) {
	f, fh, err := r.FormFile("img")
	if err != nil {
		http.Error(w, "Missing image data.", 500)
		return
	}

	img, kind, err := image.Decode(f)
	if err != nil || img == nil {
		http.Error(w, err.Error(), 500)
		return
	}

	fn := fh.Filename
	dot := strings.LastIndex(fn, ".")
	if dot >= 0 {
		fn = fn[0:dot]
	}
	fn = fmt.Sprintf("%v.png", fn)

	log.Print("Image filename: ", fh.Filename,
		" type: ", fh.Header["Content-Type"],
		" decoded-as: ", kind,
		" new-fn: ", fn)<commit_msg>go back to using upstream now that they fixed the bug<commit_after>package main

import (
	"fmt"
	"image"
	"image/png"
	"log"
	"net/http"
	"os"
	"strings"

	// Load all the file formats
	_ "code.google.com/p/go.image/bmp"
	_ "code.google.com/p/go.image/tiff"
	_ "github.com/ftrvxmtrx/groke/image/pcx"
	_ "github.com/knieriem/g/image/xbm"
	_ "github.com/knieriem/g/image/pnm"
	_ "github.com/mewrnd/blizzconv/images/cel"
	_ "github.com/mewrnd/blizzconv/images/cl2"
	_ "image/gif"
	_ "image/jpeg"
)

func convert(w http.ResponseWriter, r *http.Request) {
	f, fh, err := r.FormFile("img")
	if err != nil {
		http.Error(w, "Missing image data.", 500)
		return
	}

	img, kind, err := image.Decode(f)
	if err != nil || img == nil {
		http.Error(w, err.Error(), 500)
		return
	}

	fn := fh.Filename
	dot := strings.LastIndex(fn, ".")
	if dot >= 0 {
		fn = fn[0:dot]
	}
	fn = fmt.Sprintf("%v.png", fn)

	log.Print("Image filename: ", fh.Filename,
		" type: ", fh.Header["Content-Type"],
		" decoded-as: ", kind,
		" new-fn: ", fn)
{'fraction_non_alphanumeric': 0.1907139291063405, 'fraction_numerical': 0.008986520219670495, 'mean_word_length': 3.32829373650108, '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': '6968022', 'n_tokens_mistral': 922, 'n_tokens_neox': 876, 'n_words': 161}