Merge "Fix regexp for matching all full urls to match part with &"
diff --git a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
index b57e4ff..d183211 100644
--- a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
+++ b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text.ts
@@ -126,7 +126,7 @@
this.repoCommentLinks = repoCommentLinks;
// Always linkify URLs starting with https?://
this.repoCommentLinks['ALWAYS_LINK_HTTP'] = {
- match: '(https?://((?!&(gt|lt|amp|quot|apos);)\\S)+[\\w/~-])',
+ match: '(https?://((?!&(gt|lt|quot|apos);)\\S)+[\\w/~-])',
link: '$1',
enabled: true,
};
diff --git a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
index 23f1594..c1b38d5 100644
--- a/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-formatted-text/gr-formatted-text_test.ts
@@ -235,6 +235,11 @@
await checkLinking('https://www.google.com/');
await checkLinking('https://www.google.com/asdf~');
await checkLinking('https://www.google.com/asdf-');
+ await checkLinking('https://www.google.com/asdf-');
+ // matches & part as well, even we first linkify and then htmlEscape
+ await checkLinking(
+ 'https://google.com/traces/list?project=gerrit&tid=123'
+ );
});
});
@@ -710,6 +715,10 @@
await checkLinking('http://www.google.com');
await checkLinking('https://www.google.com');
await checkLinking('https://www.google.com/');
+ // matches & part as well, even we first linkify and then htmlEscape
+ await checkLinking(
+ 'https://google.com/traces/list?project=gerrit&tid=123'
+ );
});
suite('user suggest fix', () => {