Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
anonymous-matomo-user opened this issue Aug 31, 2010 · 1 comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

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
Copy link
Member

mattab commented Dec 20, 2010

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

@anonymous-matomo-user anonymous-matomo-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
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

2 participants