session-desktop/ts/opengroup
Jason Rhinelander 1ec637b551
Open group regex fixes (#2058)
* Open group URL regex fixes

- Capital letters in room tokens were not being accepted (it eventually
  gets lower-cased internally, which works fine, but that happens
  *after* the URL is tested for acceptability).
- `-` in room was not being allowed (it is and always has been on SOGS,
  session-android, and session-ios).
- single-letter room ids are valid, but only 2+ letter ids were being
  accepted.
- complete URL regex wasn't anchored so something like
  `garbagehttps://example.com/room?public_key=<64hex>moregarbage` was
  being accepted in the GUI input (it fails later when other code tries
  to parse it as a URL).
- removed `m` modifier from open group regex: without anchors it wasn't
  doing anything anyway, but *with* anchors it would still allow
  leading/trailing garbage if delineated by newlines.
- public key regex was accepting g-z letters, and not accepting A-F.
- various regex cleanups:
  - use non-capture groups (?:...) rather than capturing groups (...)
  - avoid repetition in host segment matching
- tightened up host pattern matching a bit:
  - DNS host segments have a max length of 63
  - Limit port max length to 5, and disallow starting with 0

* Show an error when the open group URL is invalid

It's quite disconcerting when you have a bad open group URL and try to
add it and the join button just "doesn't work" without any feedback at
all.  Fix it to show an error message.  (There is already an i18n entry
for this because this same message is thrown if the URL can't be parsed
later on).
2021-12-01 10:14:18 +11:00
..
opengroupV2 Merge pull request #2036 from Bilb/fix-search-result-inactive-convo 2021-11-17 16:03:22 +11:00
utils Open group regex fixes (#2058) 2021-12-01 10:14:18 +11:00