Actions
Defect #40237
closedError in autocomplete (`ActionController::BadRequest (Invalid query parameters: invalid %-encoding (%)`)
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
If you type a character after `@` in issues, etc., it will auto-complete.
If the character contains `%`, an error is output to the server log.
The following patch seems to fix it.
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -1167,7 +1167,7 @@ function inlineAutoComplete(element) {
if (event.target.type === 'text' && $(element).attr('autocomplete') != 'off') {
$(element).attr('autocomplete', 'off');
}
- remoteSearch(getDataSource('issues') + text, function (issues) {
+ remoteSearch(getDataSource('issues') + encodeURIComponent(text), function (issues) {
return cb(issues);
});
},
@@ -1189,7 +1189,7 @@ function inlineAutoComplete(element) {
{
trigger: '[[',
values: function (text, cb) {
- remoteSearch(getDataSource('wiki_pages') + text, function (wikiPages) {
+ remoteSearch(getDataSource('wiki_pages') + encodeURIComponent(text), function (wikiPages) {
return cb(wikiPages);
});
},
@@ -1211,7 +1211,7 @@ function inlineAutoComplete(element) {
values: function (text, cb) {
const url = getDataSource('users');
if (url) {
- remoteSearch(url + text, function (users) {
+ remoteSearch(url + encodeURIComponent(text), function (users) {
return cb(users);
});
}
- Error Examples
input: `@a%`
log: `ActionController::BadRequest (Invalid query parameters: invalid -encoding (a)):`
input: `#%`
log: `ActionController::BadRequest (Invalid query parameters: invalid -encoding ()):`
- environment
$ git rev-parse --short HEAD e8c373e55
$ RAILS_ENV=development bin/about Environment: Redmine version 5.1.1.devel Ruby version 3.1.4-p223 (2023-03-30) [x86_64-linux] Rails version 7.1.3 Environment development Database adapter SQLite Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery smtp Redmine settings: Redmine theme Default SCM: Subversion 1.14.2 Mercurial 6.3.2 Git 2.39.2 Filesystem Redmine plugins: no plugin installed
Updated by Marius BĂLTEANU 10 months ago
- Target version changed from Candidate for next minor release to 5.0.8
Updated by Marius BĂLTEANU 10 months ago
- Category set to UI
- Status changed from Confirmed to Resolved
- Assignee set to Marius BĂLTEANU
- Resolution set to Fixed
Abe Tomoaki, thanks for reporting and fixing the issue, I've just committed your solution. The fix will be available in the new maintenance releases.
Actions