|
@ -54,6 +54,10 @@ func (ctx *SubmitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
Created: time.Now(), |
|
|
Created: time.Now(), |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
err := q.CheckValid() |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
pg.Message = err.Error() |
|
|
|
|
|
} else { |
|
|
err := ctx.Storage.AddQURL(q) |
|
|
err := ctx.Storage.AddQURL(q) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
http.Error(w, fmt.Sprintf("Database error: %s", err.Error()), |
|
|
http.Error(w, fmt.Sprintf("Database error: %s", err.Error()), |
|
@ -65,6 +69,7 @@ func (ctx *SubmitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
pg.URL = fmt.Sprintf("https://qurl.org/%s", qurl.ToString(q.ID)) |
|
|
pg.URL = fmt.Sprintf("https://qurl.org/%s", qurl.ToString(q.ID)) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
err := ctx.template.Execute(&buf, pg) |
|
|
err := ctx.template.Execute(&buf, pg) |
|
|