Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
taxonomy.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
7 Sep 2007 at 14:27 UTC
Updated:
14 Jul 2012 at 23:27 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Zen commentedI assume that you are using pgSQL? This shouldn't really be a problem with MySQL (untested) as varchar fields are automatically trimmed.
re: patch - could you please move the trim to _nat_update_terms? Also, when you submit a patch, please set the status to "code needs review".
Cheers,
-K
Comment #2
alexiscott commentedI'm using MySQL 5.038
Thanks for the tip on submitting.
New version uploaded.
Comment #3
alexiscott commentedI'm more of a themer than a developer, so I don't really know why the title varchar is not geting stripped in mySQL 5, for me, but this patch seems to fix the problem described, fo me.
If I have made any mistakes in my second patch, please let me know.
Thanks!
arcX
Comment #4
Zen commentedHello Alex,
Apologies for the delay.
a) MySQL varchar fields preserve trailing whitespace from v5 onwards.
b) The same issue also applies to the taxonomy module in general. Adding a term via the taxonomy UI with trailing whitespace will result in the same issue.
c) Fixing point b will involve adding the trims to taxonomy_save_term which is what the NAT module calls eventually.
Therefore, it will be best if you take this issue to the core queue and provide a patch for taxonomy_save_term. This issue might actually prove to be a lot more widespread than just the taxonomy module though, and should probably be fixed in the forms API.
Not sure how applicable this is for D6 though.
Patch: Incidentally, your last patch had a lot of other changes mixed in it. Also, when you submit a patch, please be sure to set it to "Patch (Code needs review)".
Leaving issue open.
-K
Comment #5
Zen commentedMoving to Drupal queue.
Comment #6
jody lynnNew patch trims terms in taxonomy_save_term as suggested by Zen
Comment #7
jody lynnComment #8
Anonymous (not verified) commentedThe patch above needs reworking as it fails when applied to the latest CVS snapshot of Drupal 7.x.
Comment #9
Anonymous (not verified) commentedOops.
Comment #10
roychri commentedI'll work on this.
Comment #11
roychri commentedHere's a re-rolled patch. I have tested it against free tagging and confirmed it fixed the bug.
Comment #12
webchickTested patch and it works, but there's a minor coding standard violation. Need a space after the if and before the {. :)
Comment #13
roychri commentedHere's the new version with the correct format to comply to the coding standards.
Comment #14
gonzgonz commentedHi,
I've applied this patch to the dev tarbal of Drupal 7.x and it works!!!
Comment #15
catchStill applies with offset. Seems like a good change to me. However there's an issue elsewhere for trimming usernames in the login form, so I'm marking back to review to see if we need to do this more generally.
Comment #16
swentel commentedWhile we are on the subject, you can also save a vocabulary with a space in it. Let's fix this in the same run ? (I can imagine a use case for views having trouble with it, unless views trims it)
Comment #17
catchRe-rolled including vocabulary names, and although it's clear what's going on, some comments.
Comment #18
jody lynnRe-rolled to deal with taxonomy API changes.
To summarize, this patch trims whitespace from taxonomy terms and vocabulary names.
Comment #19
dries commentedCommitted to CVS HEAD. Thanks.