I installed this module and everything seems to work fine except that, i get an error msg:

Notice: Undefined variable: extension in DownloadLinks->_download_link_labeler_replace_callback() (line 139 of /home/test/sites/all/modules/contrib/download_link_labeler/download_link_labeler.module)

i'm running Drupal 7.64 with PHP 7.2.x

Comments

duvien created an issue. See original summary.

matthand’s picture

I will troubleshoot this bug soon. Thank you for bringing it to my attention.

  • 8133690 committed on 7.x-1.x
    Issue #3040300: Notice: Undefined variable error msg
    
matthand’s picture

Assigned: Unassigned » matthand

I just pushed an update to the 7.x branch with a bugfix for local files containing spaces and other special characters in the filename. Previously, a URL Encoded filename was passed to the local file functions being used by PHP, instead of the actual decoded filename. If this doesn't fix your issue, can you please give me more details?

What is the href of the link you are adding labels to?

Do you have any extra spaces or commas or any odd characters in the settings configuration form?

Thanks for helping me out by providing your use case!

  • matthand authored 4c3449e on 7.x-1.x
    Issue #3040300 by matthand: Notice: Undefined variable error msg
    
onejam’s picture

Just tested your new update. Thanks for that. But still showing same error though now it says error on line 140 instead.

The link is to a pdf file:
<a href="/sites/default/files/content-uploads/pdf/europe-2018_book.pdf" target="_blank">Europe 2018 Book</a>

Please note, the link renders fine and the download labeller is working as expected. It is just the error msg i get when viewing the page that renders the link to add the label and file size info.

matthand’s picture

Version: 7.x-1.0-beta2 » 7.x-1.0-beta3

Okay, I'm having trouble reproducing the bug. I'm glad it works, but I certainly do not want my module throwing errors!

Can you double check your Text Format configuration form? Did you change the configuration at all to include more filename extensions? It would be in the fieldset labeled "filter settings" at the bottom of the text format settings page, like this form for the "full html" text format at the path: /admin/config/content/formats/full_html

I'll continue to review the code that sets the $extension variable to try to find the bug.

matthand’s picture

Hi again... Can you test the 7.x-dev release version? I think I have your bug fixed. I still can't replicate your issue though. So I really need your help to test. Thank you!

daiwik.addweb’s picture

Status: Active » Needs review
StatusFileSize
new494 bytes

@duvien, kindly review the below-attached patch where I Defined variable when the function starts to resolve the seen notice error.

Thanks!

matthand’s picture

Status: Needs review » Fixed

Bug fixed in last Drupal 7 release.

Status: Fixed » Closed (fixed)

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