Commit d1c69432 authored by santiaago's avatar santiaago
Browse files

quick fix of route.Get, will need to properly handle this later..

parent fc8825b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ import (
// Color is the handler for /checkerboard/:colorId
// build a 6x6 checkerboard with alternate colors based on the number passed in the url
func Color(w http.ResponseWriter, r *http.Request) {
	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")
	if colorId, err := strconv.ParseInt(id, 0, 64); err != nil {
		log.Printf("error when extracting permalink id: %v", err)
	} else {
+5 −5
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ import (
// Isogrids is the handler for /isogrids/:key
// builds a 10x10 grid with alternate colors based on the string passed in the url.
func Isogrids(w http.ResponseWriter, r *http.Request) {
	key := route.Context.Get(r, "key")
	key, _ := route.Context.Get(r, "key")
	h := md5.New()
	io.WriteString(h, key)
	key = fmt.Sprintf("%x", h.Sum(nil)[:])
@@ -41,14 +41,14 @@ func Isogrids(w http.ResponseWriter, r *http.Request) {
// Color is the handler for /isogrids/:colorId/:key
// builds a 10x10 grid with alternate colors based on the string passed in the url.
func Color(w http.ResponseWriter, r *http.Request) {
	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")

	colorId, err := strconv.ParseInt(id, 0, 64)
	if err != nil {
		colorId = 0
	}

	key := route.Context.Get(r, "key")
	key, _ := route.Context.Get(r, "key")
	h := md5.New()
	io.WriteString(h, key)
	key = fmt.Sprintf("%x", h.Sum(nil)[:])
@@ -164,7 +164,7 @@ func Random(w http.ResponseWriter, r *http.Request) {
}

func RandomColor(w http.ResponseWriter, r *http.Request) {
	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")
	colorId, err := strconv.ParseInt(id, 0, 64)
	if err != nil {
		colorId = 0
@@ -199,7 +199,7 @@ func RandomMirror(w http.ResponseWriter, r *http.Request) {
}

func RandomMirrorColor(w http.ResponseWriter, r *http.Request) {
	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")
	colorId, err := strconv.ParseInt(id, 0, 64)
	if err != nil {
		colorId = 0
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ func Random(w http.ResponseWriter, r *http.Request) {
// handler for "/squares/random/:colorId"
// generates a grid random image with a specific color based on the colorMap
func RandomColor(w http.ResponseWriter, r *http.Request) {
	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")
	if colorId, err := strconv.ParseInt(id, 0, 64); err != nil {
		log.Printf("error when extracting permalink id: %v", err)
	} else {
+3 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import (
// Square is the handler for /squares/:key
// builds a 6x6 grid with alternate colors based on the number passed in the url.
func Square(w http.ResponseWriter, r *http.Request) {
	key := route.Context.Get(r, "key")
	key, _ := route.Context.Get(r, "key")
	h := md5.New()
	io.WriteString(h, key)
	key = fmt.Sprintf("%x", h.Sum(nil)[:])
@@ -61,13 +61,13 @@ func Square(w http.ResponseWriter, r *http.Request) {
// build a 6x6 grid with alternate colors based on the number passed in the url
func Color(w http.ResponseWriter, r *http.Request) {

	id := route.Context.Get(r, "colorId")
	id, _ := route.Context.Get(r, "colorId")
	colorId, err := strconv.ParseInt(id, 0, 64)
	if err != nil {
		colorId = 0
	}

	key := route.Context.Get(r, "key")
	key, _ := route.Context.Get(r, "key")
	h := md5.New()
	io.WriteString(h, key)
	key = fmt.Sprintf("%x", h.Sum(nil)[:])