Opened 16 years ago
Closed 7 years ago
#9274 closed defect (fixed)
Using a '#' in a custom field names breaks saved custom queries.
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | query system | Version: | 0.11.3 |
| Severity: | minor | Keywords: | bitesized |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
I will apologize in advance if this is covered elsewhere, I searched, but could not find a ticket.
I'm using Trac 0.11.3 (with a few variances, and a few selected updates from newer versions of trac)
I have a custom field with a # in the name. (eg: Test #)
I ran a custom query that uses this field name as a column (&col=Test+#)
When I run the custom query, I have no problem, the report returns what I expect.
Then I save the report, and load it. Of the columns I want displayed, only a few display.
What I noticed was, upon running the custom query for the first time, the url has &col=Test+%23 (so, the # is converted into something a bit more url safe), but the url, when loading the saved query, has &col=Test+#, meaning the # was not converted.
I can of course get past this by 1. changing the name of my field, or 2. modifying the saved custom query to store &col=Test+%23
Attachments (0)
Change History (3)
comment:1 by , 16 years ago
| Keywords: | bitesized added |
|---|---|
| Milestone: | → next-major-0.1X |
| Severity: | normal → minor |
comment:2 by , 13 years ago
Looks like this bug is already closed. Log already gives a warning: Trac[api] WARNING: Invalid name for custom field: "test_field #" (ignoring)
comment:3 by , 7 years ago
| Component: | report system → query system |
|---|---|
| Milestone: | next-major-releases |
| Resolution: | → fixed |
| Status: | new → closed |
Name of custom field must be matched with ^[a-zA-Z][a-zA-Z0-9_]+$. Currently, # cannot be used.



You should indeed use
testnras the custom field name, and specify Test # as the descriptive label:See TracTicketsCustomFields#AvailableFieldTypesandOptions.
As we already blacklist reserved names when considering custom field names, we should perhaps also complain when forbidden characters are used in those names.