OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
fix special chars in search
ulferts269416aad9e2
diff --git a/app/services/api/v3/parse_query_params_service.rb b/app/services/api/v3/parse_query_params_service.rbindex bc474d2d2b5..ee20c633f9d 100644--- a/app/services/api/v3/parse_query_params_service.rb+++ b/app/services/api/v3/parse_query_params_service.rb@@ -118,19 +118,22 @@ module APIfilters = params[:filters]filters = JSON.parse filters if filters.is_a? String- filters.each_with_object([]) do |filter, array|- attribute = filter.keys.first # there should only be one attribute per filter- operator = filter[attribute]['operator']- values = filter[attribute]['values']- ar_attribute = convert_filter_attribute attribute, append_id: true-- internal_representation = { field: ar_attribute,- operator: operator,- values: values }- array << internal_representation+ filters.map do |filter|+ filter_from_params(filter)endend+ def filter_from_params(filter)+ attribute = filter.keys.first # there should only be one attribute per filter+ operator = filter[attribute]['operator']+ values = Array(filter[attribute]['values']).map { |v| CGI.unescape(v.to_s) }+ ar_attribute = convert_filter_attribute attribute, append_id: true++ { field: ar_attribute,+ operator: operator,+ values: values }+ end+def columns_from_params(params)columns = params_value(params, KEYS_COLUMNS)diff --git a/frontend/src/app/modules/global_search/input/global-search-input.component.ts b/frontend/src/app/modules/global_search/input/global-search-input.component.tsindex 060008048f6..d03423e242e 100644--- a/frontend/src/app/modules/global_search/input/global-search-input.component.ts+++ b/frontend/src/app/modules/global_search/input/global-search-input.component.ts@@ -236,6 +236,8 @@ export class GlobalSearchInputComponent implements OnInit, OnDestroy {idOnly = true;}+ query = encodeURIComponent(query);+let href:string = this.PathHelperService.api.v3.wpBySubjectOrId(query, idOnly);this.addSuggestions();diff --git a/spec/services/api/v3/parse_query_params_service_spec.rb b/spec/services/api/v3/parse_query_params_service_spec.rbindex 1e27fb2596b..69d197a8933 100644--- a/spec/services/api/v3/parse_query_params_service_spec.rb+++ b/spec/services/api/v3/parse_query_params_service_spec.rb@@ -230,6 +230,16 @@ describe ::API::V3::ParseQueryParamsService,endend+ it_behaves_like 'transforms' do+ let(:params) do+ { filters: JSON::dump([{ 'subprojectId' => { 'operator' => '=',+ 'values' => %w(a%26%23b 2) } }]) }+ end+ let(:expected) do+ { filters: [{ field: 'subproject_id', operator: '=', values: %w(a&#b 2) }] }+ end+ end+it_behaves_like 'transforms' dolet(:params) do{ filters: JSON::dump([{ 'watcher' => { 'operator' => '=',