Browse Source

fix: saving

Jon Lundy 3 months ago
parent
commit
02c68ce96e
2 changed files with 2 additions and 3 deletions
  1. 2 2
      internal/paste/paste.go
  2. 0 1
      main.go

+ 2 - 2
internal/paste/paste.go

@@ -90,7 +90,7 @@ func New(ctx context.Context, opts ...Option) (*service, error) {
 	if srv.log != nil {
 		srv.log(srv)
 	}
-	http.HandleFunc("/paste/", srv.mux)
+	http.Handle("/paste/", srv)
 	http.Handle("/", http.FileServer(html5.New(srv.assets)))
 
 	return srv, nil
@@ -156,7 +156,7 @@ func (srv *service) Shutdown(ctx context.Context) error {
 	return wg.Wait()
 }
 
-func (srv *service) mux(w http.ResponseWriter, r *http.Request) {
+func (srv *service) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 	id := r.URL.Path
 	id = strings.TrimPrefix(id, "/api/")
 	id = strings.TrimPrefix(id, "/paste/")

+ 0 - 1
main.go

@@ -57,7 +57,6 @@ func appversion() string {
 	release := strings.TrimSpace(release)
 	return fmt.Sprintf("Paste API (%s-%s)", version, release)
 }
-
 func logVersions(log func(...interface{})) {
 	info, ok := debug.ReadBuildInfo()
 	if !ok {