mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix incorrect backslash escaping in htaccess template
This commit is contained in:
parent
aa7a9565ce
commit
65ff0a4d38
@ -14,10 +14,10 @@
|
||||
|
||||
# Allow error pages
|
||||
RewriteCond %{REQUEST_FILENAME} -f
|
||||
RewriteRule error[^\\/]*\.html$ - [L]
|
||||
RewriteRule error[^\\\\/]*\\.html$ - [L]
|
||||
|
||||
# Block invalid file extensions
|
||||
RewriteCond %{REQUEST_URI} !\.(?i:<% loop $AllowedExtensions %>$Extension<% if not $Last %>|<% end_if %><% end_loop %>)$
|
||||
RewriteCond %{REQUEST_URI} !\\.(?i:<% loop $AllowedExtensions %>$Extension<% if not $Last %>|<% end_if %><% end_loop %>)$
|
||||
RewriteRule .* - [F]
|
||||
|
||||
# Non existant files passed to requesthandler
|
||||
|
@ -44,14 +44,14 @@ class AssetAdapterTest extends SapphireTest {
|
||||
$htaccess = $adapter->read('.htaccess');
|
||||
$content = $htaccess['contents'];
|
||||
// Allowed extensions set
|
||||
$this->assertContains('RewriteCond %{REQUEST_URI} !.(?i:', $content);
|
||||
$this->assertContains('RewriteCond %{REQUEST_URI} !\\.(?i:', $content);
|
||||
foreach(File::config()->allowed_extensions as $extension) {
|
||||
$this->assertRegExp('/\b'.preg_quote($extension).'\b/', $content);
|
||||
}
|
||||
|
||||
// Rewrite rules
|
||||
$this->assertContains('RewriteRule .* ../framework/main.php?url=%1 [QSA]', $content);
|
||||
$this->assertContains('RewriteRule error[^\\/]*.html$ - [L]', $content);
|
||||
$this->assertContains('RewriteRule error[^\\\\/]*\\.html$ - [L]', $content);
|
||||
|
||||
// Test flush restores invalid content
|
||||
\file_put_contents($this->rootDir . '/.htaccess', '# broken content');
|
||||
|
Loading…
Reference in New Issue
Block a user