Shorten the view URI to /p/...

This commit is contained in:
James Mills 2017-07-09 11:25:50 -07:00
parent 52802aff70
commit f8b5ce3e9c
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6

View File

@ -139,7 +139,7 @@ func (s *Server) PasteHandler() httprouter.Handle {
uuid := shortuuid.NewWithNamespace(s.config.fqdn)
s.store.Set(uuid, blob, cache.DefaultExpiration)
u, err := url.Parse(fmt.Sprintf("./view/%s", uuid))
u, err := url.Parse(fmt.Sprintf("./p/%s", uuid))
if err != nil {
http.Error(w, "Internal Error", http.StatusInternalServerError)
}
@ -256,7 +256,7 @@ func (s *Server) initRoutes() {
s.router.GET("/", s.IndexHandler())
s.router.POST("/", s.PasteHandler())
s.router.GET("/download/:uuid", s.DownloadHandler())
s.router.GET("/view/:uuid", s.ViewHandler())
s.router.GET("/p/:uuid", s.ViewHandler())
}
// NewServer ...