Opened 18 years ago
Closed 15 years ago
#4136 closed defect (fixed)
Can not query values that contain "reserved" characters (ampersand, comma, pipe)
Reported by: | 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: |
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 (0)
Change History (10)
comment:1 by , 18 years ago
Milestone: | → 0.11 |
---|---|
Owner: | changed from | to
Severity: | normal → minor |
comment:2 by , 18 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 , 18 years ago
milestones with a space in it won't work in queries either.
For example:
comment:4 by , 18 years ago
The query above was:
[query:type=defect&milestone="Video-opslag: MPEG4 in MP4" Overzicht defecten]
comment:5 by , 18 years ago
For quoting spaces, this should be:
[query:"type=defect&milestone=Video-opslag: MPEG4 in MP4" 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 , 16 years ago
Keywords: | query added |
---|---|
Milestone: | 0.11.2 → 0.12 |
comment:7 by , 16 years ago
Summary: | Can not query values that contain & (ampersand) characters → 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:9 by , 15 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 , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Documentation updated in 0.12/TracQuery@3, and in the follow-up [8722].
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.