Edgewall Software

Opened 16 years ago

Closed 13 years ago

#4136 closed defect (fixed)

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

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


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 (0)

Change History (10)

comment:1 by Christian Boos, 16 years ago

Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor

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 by ThurnerRupert, 16 years ago

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 by anonymous, 16 years ago

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

For example:

MPEG4 in MP4" Overzicht defecten

comment:4 by anonymous, 16 years ago

The query above was:

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

comment:5 by Christian Boos, 16 years ago

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 by Christian Boos, 14 years ago

Keywords: query added

comment:7 by anonymous, 14 years ago

Summary: Can not query values that contain & (ampersand) charactersCan 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 by Remy Blank, 13 years ago

Owner: changed from Christian Boos to Remy Blank

I'll take care of that.

comment:9 by Remy Blank, 13 years ago

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 by Remy Blank, 13 years ago

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.