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

Closed
anonymous-piwik-user opened this Issue Aug 31, 2010 · 1 comment

2 participants

@anonymous-piwik-user

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)
         {
@mattab
Piwik Open Source Analytics member

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

@anonymous-piwik-user anonymous-piwik-user added this to the Piwik 1.1 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment