diff --git a/main.go b/main.go
index 2968be6..ad64919 100644
--- a/main.go
+++ b/main.go
@@ -76,6 +76,11 @@ func (sl *ShortLinks) serveRoot(w http.ResponseWriter, r *http.Request) {
}
func (sl *ShortLinks) serveRootWithPath(w http.ResponseWriter, r *http.Request, path string) {
+ err := r.ParseForm()
+ if err != nil {
+ sendError(w, http.StatusBadRequest, "Parse form: %s", err)
+ return
+ }
log.Printf("%s %s %s %s %s", r.RemoteAddr, r.Method, r.Host, sl.getDomain(r.Host), r.URL)
if !sl.isWritable(r.Host) {
@@ -83,9 +88,10 @@ func (sl *ShortLinks) serveRootWithPath(w http.ResponseWriter, r *http.Request,
return
}
- err := sl.tmpl.Execute(w, map[string]any{
+ err = sl.tmpl.Execute(w, map[string]any{
"path": path,
"host": sl.getDomain(r.Host),
+ "long": r.Form.Get("long"),
})
if err != nil {
sendError(w, http.StatusInternalServerError, "error executing template: %s", err)
diff --git a/static/index.html b/static/index.html
index e31f1a6..e77e90b 100644
--- a/static/index.html
+++ b/static/index.html
@@ -297,7 +297,7 @@ document.addEventListener('DOMContentLoaded', async () => {
-
+