FileField description token not properly defined

tomboone - February 29, 2008 - 17:36
Project:FileField
Version:6.x-3.0-beta3
Component:Code
Category:bug report
Priority:normal
Assigned:scottrigby
Status:closed
Description

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.

#1

tomboone - February 29, 2008 - 17:50
Status:active» needs review

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

AttachmentSize
filefield-228466-1.patch 1.16 KB

#2

jpetso - March 1, 2008 - 08:17
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)!

#3

Anonymous (not verified) - March 15, 2008 - 08:23
Status:fixed» closed

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

#4

scottrigby - March 25, 2009 - 20:26
Version:5.x-2.3-rc2» 6.x-3.0-beta3
Assigned to:tomboone» scottrigby
Status:closed» needs review

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

<?php
  $tokens
['filefield-description']        = isset($item['description']) ? $item['description'] : '';
?>

should be:

<?php
$tokens
['filefield-description']        = isset($item['data']['description']) ? $item['data']['description'] : '';
?>

because the $item array looks like this:

<?php
Array
(
    [
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
)
?>

AttachmentSize
filefield_228466_2.patch 1018 bytes

#5

quicksketch - March 25, 2009 - 21:16
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!

#6

System Message - April 8, 2009 - 21:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.