-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/1.4'
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
bundle/DependencyInjection/Compiler/IoStorageAllowListPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Netgen\Bundle\SiteBundle\DependencyInjection\Compiler; | ||
|
||
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use function array_merge; | ||
use function array_search; | ||
|
||
class IoStorageAllowListPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$scopes = array_merge( | ||
[ConfigResolver::SCOPE_DEFAULT], | ||
$container->getParameter('ezpublish.siteaccess.list') | ||
); | ||
|
||
foreach ($scopes as $scope) { | ||
if ($container->hasParameter("ezsettings.{$scope}.io.file_storage.file_type_blacklist")) { | ||
$bannedFileTypes = $container->getParameter("ezsettings.{$scope}.io.file_storage.file_type_blacklist"); | ||
$index = array_search('svg', $bannedFileTypes, true); | ||
|
||
if ($index !== false) { | ||
unset($bannedFileTypes[$index]); | ||
$container->setParameter("ezsettings.{$scope}.io.file_storage.file_type_blacklist", array_values($bannedFileTypes)); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters