Shorten the view URI to /p/...
This commit is contained in:
parent
52802aff70
commit
f8b5ce3e9c
@ -139,7 +139,7 @@ func (s *Server) PasteHandler() httprouter.Handle {
|
|||||||
uuid := shortuuid.NewWithNamespace(s.config.fqdn)
|
uuid := shortuuid.NewWithNamespace(s.config.fqdn)
|
||||||
s.store.Set(uuid, blob, cache.DefaultExpiration)
|
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 {
|
if err != nil {
|
||||||
http.Error(w, "Internal Error", http.StatusInternalServerError)
|
http.Error(w, "Internal Error", http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
@ -256,7 +256,7 @@ func (s *Server) initRoutes() {
|
|||||||
s.router.GET("/", s.IndexHandler())
|
s.router.GET("/", s.IndexHandler())
|
||||||
s.router.POST("/", s.PasteHandler())
|
s.router.POST("/", s.PasteHandler())
|
||||||
s.router.GET("/download/:uuid", s.DownloadHandler())
|
s.router.GET("/download/:uuid", s.DownloadHandler())
|
||||||
s.router.GET("/view/:uuid", s.ViewHandler())
|
s.router.GET("/p/:uuid", s.ViewHandler())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer ...
|
// NewServer ...
|
||||||
|
Loading…
Reference in New Issue
Block a user