Explorar el Código

Catch errors parsing PreviewsHost URI

This prevents the app crashing if a bad URI is given.
pull/4/head
Matt Baer hace 6 años
padre
commit
702d5234c0
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. +5
    -0
      construction.go

+ 5
- 0
construction.go Ver fichero

@@ -7,6 +7,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
"os"
"regexp"
"strconv"
"strings"
@@ -90,6 +91,10 @@ func addPublicAccess(app *app, houseID, html string) error {
data.Set("url", fmt.Sprintf("%s/%s.html", app.cfg.HostName, houseID))

u, err := url.ParseRequestURI(app.cfg.PreviewsHost)
if err != nil {
fmt.Fprintf(os.Stderr, "Error parsing request URI: %v\n", err)
return err
}
u.Path = "/"
urlStr := fmt.Sprintf("%v", u)



Cargando…
Cancelar
Guardar