From 1165b4ef3407d2728fc3a8390d49132ef6f0e946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Gilli?= Date: Tue, 20 Sep 2016 20:19:03 +0200 Subject: [PATCH] Fix #24 : Encoding special caracters for filename --- src/PHPePub/Core/EPub.php | 1 + src/PHPePub/Core/StaticData.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PHPePub/Core/EPub.php b/src/PHPePub/Core/EPub.php index bbc6fe0..2507a09 100644 --- a/src/PHPePub/Core/EPub.php +++ b/src/PHPePub/Core/EPub.php @@ -241,6 +241,7 @@ function addChapter($chapterName, $fileName, $chapterData = null, $autoSplit = f return false; } $fileName = RelativePath::getRelativePath($fileName); + $fileName = FileHelper::sanitizeFileName($fileName); $fileName = preg_replace('#^[/\.]+#i', "", $fileName); $navPoint = false; diff --git a/src/PHPePub/Core/StaticData.php b/src/PHPePub/Core/StaticData.php index 89355e1..e590d46 100644 --- a/src/PHPePub/Core/StaticData.php +++ b/src/PHPePub/Core/StaticData.php @@ -278,7 +278,7 @@ class StaticData { public static $opsContentTypes = array("application/xhtml+xml", "application/x-dtbook+xml", "application/xml", "application/x-dtbncx+xml", "text/x-oeb1-document"); - public static $forbiddenCharacters = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%"); + public static $forbiddenCharacters = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", "%", "+"); public static $namespaces = array("xsi" => "http://www.w3.org/2001/XMLSchema-instance", "opf" => "http://www.idpf.org/2007/opf",