This commit is contained in:
kenneth 2023-12-25 11:47:15 +08:00
parent 5cc3de8e26
commit 2119199368

View File

@ -69,6 +69,10 @@ func HandleShortUrlRedirect(w http.ResponseWriter, r *http.Request) {
http.Error(w, "failed to get url", http.StatusInternalServerError) http.Error(w, "failed to get url", http.StatusInternalServerError)
return return
} }
if len(link) == 0 {
http.Error(w, "short url get to long url is empty", http.StatusInternalServerError)
return
}
http.Redirect(w, r, link, http.StatusFound) http.Redirect(w, r, link, http.StatusFound)
} }