Skip to content

Commit

Permalink
urls to check must be prefixed with http(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
meadowingc committed Mar 12, 2024
1 parent 3eaa825 commit 92c5cd6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"html/template"
"net/http"
"strings"

"codeberg.org/meadowingc/fido/linkchecker"
)
Expand Down Expand Up @@ -31,6 +32,12 @@ func main() {
return
}

// Check if the submitted link starts with http:// or https://
if !strings.HasPrefix(submittedLink, "http://") && !strings.HasPrefix(submittedLink, "https://") {
http.Error(w, "Invalid link. Link must start with http:// or https://", http.StatusBadRequest)
return
}

resultUUID := linkchecker.SubmitLinkForCheck(submittedLink)

// redirect to results page
Expand Down

0 comments on commit 92c5cd6

Please sign in to comment.