Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-02 00:09:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-02 00:09:22 +0300
commitc25993c0fc4bee979facf97b38f270c8fd15bd47 (patch)
tree5a3d9301871b7350737197d90af82264a82897cb /app/assets/javascripts/gfm_auto_complete.js
parentfb7b3d71b179f877dca72d86eccf29eeb9f883b7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/gfm_auto_complete.js')
-rw-r--r--app/assets/javascripts/gfm_auto_complete.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js
index bd87d0df01a..0e33c712470 100644
--- a/app/assets/javascripts/gfm_auto_complete.js
+++ b/app/assets/javascripts/gfm_auto_complete.js
@@ -254,10 +254,18 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
matcher(flag, subtext) {
- const regexp = new RegExp(`(?:[^${glRegexp.unicodeLetters}0-9:]|\n|^):([^:]*)$`, 'gi');
+ const regexp = new RegExp(
+ `(?:[^${glRegexp.unicodeLetters}0-9:]|\n|^):([^ :][^:]*)?$`,
+ 'gi',
+ );
const match = regexp.exec(subtext);
- return match && match.length ? match[1] : null;
+ if (match && match.length) {
+ // Since we have "?" on the group, it's possible it is undefined
+ return match[1] || '';
+ }
+
+ return null;
},
filter(query, items) {
if (GfmAutoComplete.isLoading(items)) {