Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
anonymous-piwik-user opened this Issue · 1 comment

2 participants

Anonymous Piwik user Matthieu Aubry
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)
         {
Matthieu Aubry
Owner

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
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.