Browse Source

Catch errors parsing PreviewsHost URI

This prevents the app crashing if a bad URI is given.
pull/4/head
Matt Baer 6 years ago
parent
commit
702d5234c0
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      construction.go

+ 5
- 0
construction.go View File

@@ -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)



Loading…
Cancel
Save