1
0
Fork 0
mirror of https://github.com/imjasonh/go-gist synced 2026-07-06 22:42:19 +00:00

Support new gist ID format

This commit is contained in:
Jason Hall 2014-07-22 23:17:29 -04:00
parent b11b696678
commit 6776724d9c

8
app.go
View file

@ -22,10 +22,10 @@ func init() {
w.Header().Set("Content-Type", "text/html")
w.Write([]byte(fmt.Sprintf(t, r.URL.Host+r.URL.Path, mux.Vars(r)["gistID"])))
}
r.HandleFunc("/{username}/{gistID:[0-9]+}/{package:[a-zA-Z0-9]+}", h).Methods("GET")
r.HandleFunc("/{username}/{gistID:[0-9]+}", h).Methods("GET")
r.HandleFunc("/{gistID:[0-9]+}/{package:[a-zA-Z0-9]+}", h).Methods("GET")
r.HandleFunc("/{gistID:[0-9]+}", h).Methods("GET")
r.HandleFunc("/{username}/{gistID:[0-9a-f]+}/{package:[a-zA-Z0-9]+}", h).Methods("GET")
r.HandleFunc("/{username}/{gistID:[0-9a-f]+}", h).Methods("GET")
r.HandleFunc("/{gistID:[0-9a-f]+}/{package:[a-zA-Z0-9]+}", h).Methods("GET")
r.HandleFunc("/{gistID:[0-9a-f]+}", h).Methods("GET")
r.Handle("/", http.RedirectHandler("https://github.com/ImJasonH/go-gist", http.StatusSeeOther))
http.Handle("/", r)
}