diff --git a/CHANGELOG.md b/CHANGELOG.md index ab0f91b..ba021ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Alt-Left and Alt-Right for history navigation (#23) - You can type `..` in the bottom bar to go up a directory in the URL (#21) +- Error popup for when input string would result in a too long out-of-spec URL (#25) ### Changed - Bottom bar now says `URL/Num./Search: ` when space is pressed diff --git a/NOTES.md b/NOTES.md index a5335c1..ebd28f3 100644 --- a/NOTES.md +++ b/NOTES.md @@ -1,7 +1,9 @@ # Notes -- All the maps and stuff could be replaced with a `tab` struct -- And then just one single map of tab number to `tab` +- Simplify into one struct + - All the maps and stuff could be replaced with a `tab` struct + - And then just one single map of tab number to `tab` + - URL for each tab should not be stored as a string - in the current code there's lots of reparsing the URL ## Bugs - Wrapping messes up on brackets diff --git a/display/private.go b/display/private.go index ff06092..2cde509 100644 --- a/display/private.go +++ b/display/private.go @@ -288,6 +288,11 @@ func handleURL(u string) (string, bool) { // Make another request with the query string added // + chars are replaced because PathEscape doesn't do that parsed.RawQuery = pathEscape(userInput) + if len(parsed.String()) > 1024 { + // 1024 is the max size for URLs in the spec + Error("Input Error", "URL for that input would be too long.") + return "", false + } return handleURL(parsed.String()) } return "", false