#12405 closed defect (fixed)
Use of lstrip("field-") to attempt to remove the substring "field-" from front of string is erroneous
Reported by: | Owned by: | Richard Liao | |
---|---|---|---|
Priority: | highest | Component: | TracTicketChainedFieldsPlugin |
Severity: | major | Keywords: | |
Cc: | Trac Release: |
Description
In the file web_ui.py on line 177 the code is:
trigger = req.args.get("trigger", "").lstrip("field-")
The intent here is to "strip" off the substring "field-" from the beginning of the "trigger" request argument value. However, what this call actually does is strip off any of the characters in the set 'f', 'i', 'e', 'l', 'd', and '-' from the beginning of the string until a character is encountered that is NOT in the set. Therefore, if the trigger field name begins with any of these characters in the set, those characters will also be stripped off. Eg. a field named 'location' will be passed as trigger 'field-location', but after the lstrip call, trigger is set to 'ocation' instead. So any fields whose names begin with the characters in the set will fail to work as a chained field.
Attachments (0)
Change History (4)
comment:1 Changed 9 years ago by
comment:3 follow-up: 4 Changed 9 years ago by
I didn't have time to do any testing. Could you please confirm the fix?
comment:4 Changed 9 years ago by
Replying to rjollos:
I didn't have time to do any testing. Could you please confirm the fix?
This fix is working fine for me. Thanks for the quick turn around!
Perhaps something like the following will be more appropriate: