BUGFIX Loosened character replacement in static-main.php, to allow for multibyte paths (see URLSegmentFilter::$default_allow_multibyte)

This commit is contained in:
Ingo Schommer 2012-05-08 23:43:45 +02:00
parent 41b51a17ce
commit 18dbdd2df9

View File

@ -83,9 +83,11 @@ if (
$file = isset($homepageMap[$_SERVER['HTTP_HOST']]) ? $homepageMap[$_SERVER['HTTP_HOST']] : $file;
}
// Encode each part of the path individually, in order to support multibyte paths.
// SiteTree.URLSegment and hence the static folder and filenames are stored in encoded form,
// to avoid filesystem incompatibilities.
$file = implode('/', array_map('rawurlencode', explode('/', $file)));
// Find file by extension (either *.html or *.php)
$file = preg_replace('/[^a-zA-Z0-9\/\-_]/si', '-', $file);
if (file_exists($cacheBaseDir . $cacheDir . $file . '.html')) {
header('X-SilverStripe-Cache: hit at '.@date('r'));
echo file_get_contents($cacheBaseDir . $cacheDir . $file . '.html');