Edgewall Software
Modify

Ticket #4136 (closed defect: fixed)

Opened 5 years ago

Last modified 2 years ago

Can not query values that contain "reserved" characters (ampersand, comma, pipe)

Reported by: steffenp@… Owned by: rblank
Priority: normal Milestone: 0.12
Component: ticket system Version: 0.10
Severity: minor Keywords: query
Cc:
Release Notes:
API Changes:

Description

It is not possible to search for values that contain characters used as separators in the query language such as & or |.

Example: If a milestone is named "x&y" the corresponding query [query:milestone=x&y] will result in an error:

[Error: Query filter requires field and constraints separated by a "="]

The TracQuery language needs to support escaping.

Attachments

Change History

comment:1 Changed 5 years ago by cboos

  • Milestone set to 0.11
  • Owner changed from jonas to cboos
  • Severity changed from normal to minor

The "!" character used for escaping is already used there to express negation, so I think it's not an option.

So I propose to use "\", with "
" being used to escape "\" itself.

comment:2 Changed 5 years ago by ThurnerRupert

the gui query interface for milestones like this is also broken (in 0.10-3dev at least):

if you add milestones to criteria, the milestone dropdown contains "x&y", which gets translated to %26amp;y if you select it, so no result.

but the the result page contains then a correct drop down with "x&y" and then it works.

comment:3 Changed 5 years ago by anonymous

milestones with a space in it won't work in queries either.

For example:

MPEG4 in MP4" Overzicht defecten

comment:4 Changed 5 years ago by anonymous

The query above was:

[query:type=defect&milestone="Video-opslag: MPEG4 in MP4" Overzicht defecten]

comment:5 Changed 5 years ago by cboos

For quoting spaces, this should be:

[query:"type=defect&milestone=Video-opslag: MPEG4 in MP4" Overzicht defecten]

Overzicht defecten

as explained in TracLinks#QuotingspaceinTracLinks.

As for escaping the characters used in the Query syntax, there's been no other proposal than using the backslash, so I'll go for that.

comment:6 Changed 4 years ago by cboos

  • Keywords query added
  • Milestone changed from 0.11.2 to 0.12

comment:7 Changed 3 years ago by anonymous

  • Summary changed from Can not query values that contain & (ampersand) characters to Can not query values that contain "reserved" characters (ampersand, comma, pipe)

The same rule applies to , (comma), which is used as a delimeter for the TicketQuery macro

comment:8 Changed 2 years ago by rblank

  • Owner changed from cboos to rblank

I'll take care of that.

comment:9 Changed 2 years ago by rblank

It turns out that comma escaping was already possible with "\,". Escaping of "&" and "|" was added in [8721]. The change also allows "=" in values, fixes the [[TicketQuery]] when specifying col=, and adds test cases for the macro.

comment:10 Changed 2 years ago by rblank

  • Resolution set to fixed
  • Status changed from new to closed

Documentation updated in 0.12/TracQuery@3, and in the follow-up [8722].

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from rblank. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.