瀏覽代碼

Catch errors parsing PreviewsHost URI

This prevents the app crashing if a bad URI is given.
pull/4/head
Matt Baer 6 年之前
父節點
當前提交
702d5234c0
共有 1 個檔案被更改,包括 5 行新增0 行删除
  1. +5
    -0
      construction.go

+ 5
- 0
construction.go 查看文件

@@ -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…
取消
儲存