mirror of
https://github.com/makew0rld/amfora.git
synced 2025-02-02 15:07:34 -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
|
### Added
|
||||||
- Alt-Left and Alt-Right for history navigation (#23)
|
- 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)
|
- 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
|
### Changed
|
||||||
- Bottom bar now says `URL/Num./Search: ` when space is pressed
|
- Bottom bar now says `URL/Num./Search: ` when space is pressed
|
||||||
|
6
NOTES.md
6
NOTES.md
@ -1,7 +1,9 @@
|
|||||||
# Notes
|
# Notes
|
||||||
|
|
||||||
- All the maps and stuff could be replaced with a `tab` struct
|
- Simplify into one struct
|
||||||
- And then just one single map of tab number to `tab`
|
- 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
|
## Bugs
|
||||||
- Wrapping messes up on brackets
|
- Wrapping messes up on brackets
|
||||||
|
@ -288,6 +288,11 @@ func handleURL(u string) (string, bool) {
|
|||||||
// Make another request with the query string added
|
// Make another request with the query string added
|
||||||
// + chars are replaced because PathEscape doesn't do that
|
// + chars are replaced because PathEscape doesn't do that
|
||||||
parsed.RawQuery = pathEscape(userInput)
|
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 handleURL(parsed.String())
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user