summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2019-04-07 07:18:16 -0400
committerzeripath <art27@cantab.net>2019-04-07 12:18:16 +0100
commit6293736d02992ef317c0f1ffc875cdccf0fd5837 (patch)
tree00fbf299043df33893f1c173a824c4f45d13eb30 /routers
parent5422f23ed8174661b6e658250e4007b7fdf0d603 (diff)
downloadgitea-6293736d02992ef317c0f1ffc875cdccf0fd5837.tar.gz
gitea-6293736d02992ef317c0f1ffc875cdccf0fd5837.zip
Use stricter boundaries for auto-link detection (#6522)
* Use stricter boundaries for auto-link detection Currently autolinks use \W for boundary detection which creates many situations of inserting links into places they don't belong (paths, URLs, UUIDs, etc...) This fixes that by replacing \W and only allowing these matches to touch an open paren or bracket (matching what seems to be Github behavior) in addition to whitespace and start of line. Similar for ending boundary as well. Fixes #6149 (and probably others) * Update test Replace incorrect test with a value that is a valid username, based on: "Username should contain only alphanumeric, dash ('-'), underscore ('_') and dot ('.') characters." * Also allow for period at the end Matching Github behavior * Fix email regex to work properly with specificed boundaries Create a specific capture group for email address and then use FindStringSubmatchIndex to allow for non-matching patterns as boundaries. * Add Tests Add tests for new behavior -- including tests for email addresses which were absent before.
Diffstat (limited to 'routers')
0 files changed, 0 insertions, 0 deletions