Strip leading and trailing whitespace before storing a bug watch's remotebug in the db

Bug #34105 reported by Björn Tillenius
6
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Diogo Matsubara

Bug Description

If someone, by accident, includes leading or trailing whitespace when inputting the remote bug of a bug watch, for example when copy and pasting, we preserve the whitespace when storing it in the database.

This can cause subtle problems, and there's no use case for preserving the whitespace. We should strip the whitespace before storing the remote bug in the database.

Tags: lp-bugs
Revision history for this message
Björn Tillenius (bjornt) wrote :

Matsubara, maybe you could have a look at this?

Changed in malone:
assignee: nobody → matsubara
status: Unconfirmed → Confirmed
Revision history for this message
Christian Reis (kiko) wrote :

Interesting issue. It happens because we are storing remotebug as a text field instead of as an ID; this makes us more flexible but it requires more careful processing of the field.

Here are some other questions relating to the use of the text type in the DB:

- Do we strip whitespace when a user enters a value for a "name" field?
- Do we strip whitespace when a user enters a value for an email address?
- Do we strip whitespace when a user enters a wikiname or a wiki url? What about jabberid? What about irc network and nick?
- What about a product's releaseroot, or a productseries' cvs, svn or bk details?

Perhaps it makes sense to have something like a StrippedAttribute or StrippedTextLine or StrippedURL field in the interfaces?

Changed in malone:
status: Confirmed → In Progress
Revision history for this message
Björn Tillenius (bjornt) wrote :

Yes, I think StrippedTextLine makes sense. It'd be useful for more than just remote bug ids.

One question that comes to mind, though, do we ever want to preserve leading and trailing whitespace for single line input? It might be easier to simply override the default widget for text lines to always strip the leading and trailing whitespace.

Having something like StrippedTextLine would be more correct, though.

Revision history for this message
David Allouche (ddaa) wrote :

Agreed, and mpt agrees too: me should strip whitespace in all single-line text fields. Filed bug 44197 and assigned to matsubara with kiko's permission.

Changed in malone:
status: In Progress → Fix Committed
Changed in malone:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.