mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
🥅 Raise Error modal when input makes URL too long - fixes #25
This commit is contained in:
parent
33f0c6781f
commit
2a395008fa
@ -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
|
||||
|
2
NOTES.md
2
NOTES.md
@ -1,7 +1,9 @@
|
||||
# Notes
|
||||
|
||||
- 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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user