Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-5986

File Download Names have md5 added to filename

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.0.4
    • Fix Version/s: 3.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      File attachments to Events (and possibly other things, I am new to this) have the md5 added to the filename when you download them. Instead of My_Pdf.pdf you get My_Pdf_asdf146ajshadnvkia877a7sdf7ads7f.pdf.

      You can see the problem here: https://www.nasi.org/civicrm/event/info?reset=1&id=6 Well, that page might be a bad example as it also has the missing "." problem in the filename (and I also am working on a fix so as soon as it is implemented you won't be able to see the problem).

      To fix this I changed I edited line 82 of CRM/Core/Page/File.php from:

      CRM_Utils_System::download( basename( $path ), $mimeType, $buffer );

      to:

      require_once 'CRM/Utils/File.php';
      CRM_Utils_System::download( CRM_Utils_File::cleanFileName(basename( $path )), $mimeType, $buffer );

      This solves the problem. Not sure if this solution will cause any problems elsewhere.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              mhenning Matt Henning
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: