You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
forgejo/modules
mrsdizzie 6293736d02 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.
5 years ago
..
auth Better logging (#6038) (#6095) 5 years ago
avatar Use assert in legacy unit tests (#867) 8 years ago
base Better logging (#6038) (#6095) 5 years ago
cache Fix memcache support when value is returned as string always (#2924) 7 years ago
context Better logging (#6038) (#6095) 5 years ago
cron Better logging (#6038) (#6095) 5 years ago
generate Integrate OAuth2 Provider (#5378) 5 years ago
git move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
gzip Pooled and buffered gzip implementation (#5722) 6 years ago
highlight No highlighting for .txt files (#1922) 7 years ago
httplib Add sensitive headers (#3429) 7 years ago
indexer Better logging (#6038) (#6095) 5 years ago
lfs Better logging (#6038) (#6095) 5 years ago
log Quieter Integration Tests (#6513) 5 years ago
mailer Add X-Auto-Response-Suppress header to outgoing messages (#6492) 5 years ago
markup Use stricter boundaries for auto-link detection (#6522) 5 years ago
metrics Prometheus endpoint (#5256) 6 years ago
minwinsvc Fix Git hooks not being executed on Windows when running as a service (#1149) 7 years ago
notification Better logging (#6038) (#6095) 5 years ago
options Fix typos in models/ and modules/ (#1248) 7 years ago
pprof Better logging (#6038) (#6095) 5 years ago
private Clean up various use of escape/unescape functions for URL generation (#6334) 5 years ago
process Fix run command race (#1470) 7 years ago
public When redirecting clean the path to avoid redirecting to //www.othersite.com (#5669) 6 years ago
recaptcha Add Recaptcha functionality to Gitea (#4044) 6 years ago
search Global code search support (#3664) 6 years ago
secret Integrate OAuth2 Provider (#5378) 5 years ago
setting Quieter Integration Tests (#6513) 5 years ago
ssh Better logging (#6038) (#6095) 5 years ago
structs Allow to set organization visibility (public, internal, private) (#1763) 5 years ago
sync Fix status table race condition (#1835) 7 years ago
templates Better logging (#6038) (#6095) 5 years ago
test move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
uploader move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364) 5 years ago
user Remove check for negative length (#5120) 6 years ago
util Better logging (#6038) (#6095) 5 years ago
validation Clean up ref name rules (#6437) 5 years ago