Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Non-field managed files do not have descriptions. It's not in the schema at all. But somehow we have a [file:description] token which causes a PHP notice when it is used (I started implementing a [user:picture] chained token in D7).
Comments
Comment #1
Dave ReidOn my dear lord. The File token tests manually add $file->description = ... in order to pass. So, so, so wrong.
Comment #2
Dave ReidForgot to remove it from system_token_info as well.
Comment #3
Dave ReidComment #4
Dave ReidWithout reverting a potential security hole this time.
Comment #5
Dave ReidComment #6
joachim CreditAttribution: joachim commentedWhat if you want the description on managed files?
Comment #7
Dave ReidThen you want *field* tokens as provided by Token.module for D7 because the description is field instance data. The file tokens should only work with a proper file object from file_load().
Comment #8
Dave Reid@joachim Feel like RTBCing this one now that it makes sense?
Comment #9
muriqui CreditAttribution: muriqui commented#5: 978028-file-description-token-no-more-D7.patch queued for re-testing.
Comment #10
muriqui CreditAttribution: muriqui commentedRerolled patch to work with latest 7.x.
Comment #11
Dave Reid@muriqui: Please attach the patch again without the '-D7' on the end of it so it can be tested properly.
Comment #13
muriqui CreditAttribution: muriqui commentedWhoops.
Comment #14
Dave ReidComment #15
Dave Reid#13: 978028-file-description-token-no-more.patch queued for re-testing.
Comment #16
Dave ReidLooks good. Let's fix this now so we stop people from trying to use an invalid token.
Comment #17
webchickCan we get at least one review on this? Since muriqui just re-rolled your patch, you've essentially marked your own patch RTBC here.
Comment #18
Dave ReidComment #19
joachim CreditAttribution: joachim commentedPatch applies and looks good.
Comment #20
muriqui CreditAttribution: muriqui commented@webchick Does my review count, or do we need someone else since I was involved with the re-roll?
Comment #21
muriqui CreditAttribution: muriqui commentedNever mind, looks like joachim marked it RTBC before I did.
Comment #22
webchickCommitted and pushed to 8.x and 7.x. Thanks!