Opened 4 years ago

Closed 3 years ago

#1663 closed Bug (fixed)

PDFReports: invalid filename chars in website name prevent "Send Report now" button to work

Reported by: scara Owned by:
Priority: normal Milestone: Piwik 1.1
Component: Core Keywords:
Cc: Sensitive: no

Description

If e.g. a "/" is used in the website name (e.g. using kind of hierarchy based naming convention) an error will be arisen in the logs (fopen(), claiming for failed to open stream: No such file or directory) and no email will be sent.
It would be wise to cleanup the "PDFReports" filename, e.g.:

# diff -u API.php.1.0 API.php
--- API.php.1.0 2010-08-31 16:15:16.000000000 +0200
+++ API.php     2010-08-31 16:16:01.000000000 +0200
@@ -275,6 +275,12 @@
                $pdf->paintReport();
         }
         $outputFilename = 'Analytics report - '.$prettyDate.' - '.$websiteName.".pdf";
+        // Clean up the filename: \/:*?"<>|[]=+'`,;
+        $outputFilename = str_replace(
+            array('\\', '/', ':', '*', '?', '"', '<', '>', '|', '[', ']', '=', '+', "'", '`', ',', ';'),
+            array('_',  '_', '_', '_', '_', '',  '',  '',  '_', '_', '_', '',  '',  '',  '',  '_', '_'),
+            $outputFilename
+        );

         switch($outputType)
         {

Change History (3)

comment:1 Changed 4 years ago by vipsoft (robocoder)

  • Keywords PDFReports removed
  • Milestone set to 1.1 - Piwik 1.1
  • Priority changed from major to normal

comment:2 Changed 4 years ago by vipsoft (robocoder)

  • Summary changed from [1.0][PDFReports] Invalid filename chars prevent "Send Report now" button to work to PDFReports: invalid filename chars in website name prevent "Send Report now" button to work

comment:3 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

the PDF filename doesn't contain the website name in trunk, following recent commits

Note: See TracTickets for help on using tickets.