]> source.dussan.org Git - redmine.git/commitdiff
Backport r23008 from trunk to 5.1-stable (#41096).
authorGo MAEDA <maeda@farend.jp>
Thu, 5 Sep 2024 02:32:58 +0000 (02:32 +0000)
committerGo MAEDA <maeda@farend.jp>
Thu, 5 Sep 2024 02:32:58 +0000 (02:32 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@23014 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/application.js

index fcd9aed5458fe5b5b5a3c8b1b5ab45ba278e0aa2..caf680b6a56f23816ec54e9074f89bde931be0d2 100644 (file)
@@ -1164,6 +1164,12 @@ function inlineAutoComplete(element) {
             if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
               $(element).attr('autocomplete', 'off');
             }
+            // When triggered with text starting with "##", like "##a", the search term will become "#a",
+            // causing the SQL query to fail in finding issues with "a" in the subject.
+            // To avoid this, remove the first "#" from the search term.
+            if (text) {
+              text = text.replace(/^#/, '');
+            }
             remoteSearch(getDataSource('issues') + encodeURIComponent(text), function (issues) {
               return cb(issues);
             });