From 7eddaf5f0b275cd2ff37b260246d276748ac6cd4 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Mon, 1 Aug 2016 12:50:11 -0400 Subject: [PATCH] go/doc: allow ToHTML to properly handle URLs containing semicolons Fixes #16565 Change-Id: I3edfd2576a7ca5270644a4e7f126854f821f2c9a Reviewed-on: https://go-review.googlesource.com/25385 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/go/doc/comment.go | 2 +- src/go/doc/comment_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go index ed8eef4c61..15e034b6df 100644 --- a/src/go/doc/comment.go +++ b/src/go/doc/comment.go @@ -53,7 +53,7 @@ const ( filePart = `[a-zA-Z0-9_?%#~&/\-+=()]+` // parentheses may not be matching; see pairedParensPrefixLen urlRx = `(` + protocol + `)://` + // http:// hostPart + `([.:]` + hostPart + `)*/?` + // //www.google.com:8080/ - filePart + `([:.,]` + filePart + `)*` + filePart + `([:.,;]` + filePart + `)*` ) var matchRx = regexp.MustCompile(`(` + urlRx + `)|(` + identRx + `)`) diff --git a/src/go/doc/comment_test.go b/src/go/doc/comment_test.go index ad65c2a27f..76dfbeac79 100644 --- a/src/go/doc/comment_test.go +++ b/src/go/doc/comment_test.go @@ -162,6 +162,7 @@ var emphasizeTests = []struct { {"Hello http://example.com/%2f/ /world.", `Hello http://example.com/%2f/ /world.`}, {"Lorem http: ipsum //host/path", "Lorem http: ipsum //host/path"}, {"javascript://is/not/linked", "javascript://is/not/linked"}, + {"http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD", `http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD`}, } func TestEmphasize(t *testing.T) { -- 2.48.1