1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-19 19:25:24 +00:00

🥅 Raise Error modal when input makes URL too long - fixes #25

This commit is contained in:
makeworld 2020-06-29 14:25:25 -04:00
parent 33f0c6781f
commit 2a395008fa
3 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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