The code defines several tokens for data related to FileField uploads (file name, mime type, etc.), but no token exists for the file description field. Instead, there is a token defined for file title, data that does not exist in FileField. When I attempted to use the file-title token in the Auto Node Title it was blank even though there was a description filled in for the file.

Members fund testing for the Drupal project. Drupal Association Learn more


tomboone’s picture

Status: Active » Needs review
1.16 KB

Replacing 'title' with 'description' in token functions appears to fix the problem.

jpetso’s picture

Status: Needs review » Fixed

Makes sense. I committed this to CVS (DRUPAL-5--2 branch), should work in the next release.
Thanks for the patch (and the bug report in the first place)!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

scottrigby’s picture

Version: 5.x-2.3-rc2 » 6.x-3.0-beta3
Assigned: tomboone » scottrigby
Status: Closed (fixed) » Needs review
1018 bytes

The same issue seems to be happening with FileField 6.x-3.0-beta3 (& Automatic Nodetitles 6.x-1.1).

Patch against beta3.

In filefield_token.module, on line 32
$tokens['filefield-description'] = isset($item['description']) ? $item['description'] : '';

should be:
$tokens['filefield-description'] = isset($item['data']['description']) ? $item['data']['description'] : '';

because the $item array looks like this:

    [fid] => 1
    [list] => 1
    [data] => Array
            [description] => Test PDF

    [uid] => 1
    [filename] => test.pdf
    [filepath] => sites/default/files/files/test.pdf
    [filemime] => application/pdf
    [filesize] => 6575
    [status] => 1
    [timestamp] => 1238010320
quicksketch’s picture

Status: Needs review » Fixed

Thanks scottrigby, you're very right. This seems to have been an issue ever since the 3.x branch of the module which introduced the "data" serialized column. Committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.