summaryrefslogtreecommitdiffstats
path: root/modules/markup/html.go
diff options
context:
space:
mode:
authormrsdizzie <joe.mccann@gmail.com>2019-02-28 07:31:53 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2019-02-28 20:31:53 +0800
commit4a2e92bcd1060ba0c124732690fb2f51c7f9d79d (patch)
treea0d30850da4b57d32ebfad18b76ff09cc4ade2ce /modules/markup/html.go
parent4b7237b63ee4b5b1892ac6fa14afcd29568147fb (diff)
downloadgitea-4a2e92bcd1060ba0c124732690fb2f51c7f9d79d.tar.gz
gitea-4a2e92bcd1060ba0c124732690fb2f51c7f9d79d.zip
Modify linkRegex to require http|https (#6171)
Modify the current linkRegex to require http|https which appears to be the intended behavior based on the comments. Right now, it also matches anything starting with www as well. Also add testing for linkRegex
Diffstat (limited to 'modules/markup/html.go')
-rw-r--r--modules/markup/html.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/markup/html.go b/modules/markup/html.go
index 9040d43e8c..8ce8740748 100644
--- a/modules/markup/html.go
+++ b/modules/markup/html.go
@@ -66,7 +66,7 @@ var (
// matches http/https links. used for autlinking those. partly modified from
// the original present in autolink.js
- linkRegex = regexp.MustCompile(`(?:(?:http|https):\/\/(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)(?:(?:\/[\+~%\/\.\w\-]*)?\??(?:[\-\+:=&;%@\.\w]*)#?(?:[\.\!\/\\\w]*))?`)
+ linkRegex = regexp.MustCompile(`(?:(?:http|https):\/\/(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+(?:\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)(?:(?:\/[\+~%\/\.\w\-]*)?\??(?:[\-\+:=&;%@\.\w]*)#?(?:[\.\!\/\\\w]*))?`)
)
// regexp for full links to issues/pulls