When the commas were added to the form it had the negative side effect of breaking CCK's content_copy functions. As it currently stands, any content type consisting of more than one filefield property (or more than one imagefield property) will presently export with file extensions like this:
png,, jpg,, gif
export it again and you see the number of commas grow :-(
The problem is that content_copy must use a drupal_execute() to generate a macro for content type creation. drupal_execute() executes the form for the content type and while that execution includes running the hook_form_validate() portion of filefield, Drupal core only allows the hook_form_validate() to run once per form_id. As a result, while the first set of file extensions in a content type won't be negatively affected by the cosmetic change, subsequent filefields will not have the commas stripped, making exports unusable without a manual edit.
I'm thinking that any module that makes use of drupal_execute() in relation to a content type with a filefield will have this problem.
I've written a patch to fix the problem though, so have fun with that.
Comment | File | Size | Author |
---|---|---|---|
#2 | filefield_default_extensions_commas.patch | 1.8 KB | quicksketch |
filefield_widget.inc_.patch | 1012 bytes | searchingfortao |
Comments
Comment #1
quicksketchCommas are a natural thing for users to enter, rather than spaces. This same code is in Drupal 7 also, so we'll have the same problem there. Perhaps we can set the value and add the commas in #pre_render or some other location.
Comment #2
quicksketchI've committed this patch which moves the addition of commas to the cosmetic-only #pre_render location. This makes it so that commas are shown to the user but excluded from exports, since drupal_execute() doesn't run render out the form, the commas are never added when dealing with drupal_execute().