diff --git a/index.html b/index.html
index 7c27197..121d9d7 100644
--- a/index.html
+++ b/index.html
@@ -44,7 +44,11 @@ A Minimal, SQLite-Backed URL Shortener
| $ curl {{.URL}}/ddg?https://duckduckgo.com
| {{.URL}}/ddg
|
-| 5. Deleting a short link
+| 5. You can also pass an encoded URL:
+| $ curl {{.URL}}?https%3A%2F%2Fduckduckgo.com
+| {{.URL}}/1dc4cb37e81de396
+|
+| 6. Deleting a short link
| $ TMP=$(mktemp)
| $ # temp file will store header
| $ LINK=$(curl -sS {{.URL}} -d https://duckduckgo.com -D $TMP)
diff --git a/main.go b/main.go
index f0369cd..2eb164b 100644
--- a/main.go
+++ b/main.go
@@ -171,7 +171,11 @@ func (c controller) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
case http.MethodGet:
st := strings.TrimRight(r.URL.Path, "/")
- rq := r.URL.RawQuery
+ rq, err := url.QueryUnescape(r.URL.RawQuery)
+ if err != nil {
+ c.Err(rw, r, err)
+ return
+ }
if rq != "" {
u, err := url.Parse(rq)
if err != nil {