File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed
app/code/Magento/MediaGallery Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 10
10
use Magento \MediaGalleryApi \Model \Directory \IsBlacklistedInterface ;
11
11
12
12
/**
13
- * Directories blacklisted for media gallery. This class should be used for DI configuration.
14
- *
15
- * Please use the interface in the code (for constructor injection) instead of this implementation.
16
- *
17
- * @api
13
+ * Check if the path is blacklisted for media gallery. Directory path may be blacklisted if it's reserved by the system
18
14
*/
19
15
class IsBlacklisted implements IsBlacklistedInterface
20
16
{
17
+ const XML_PATH_BLACKLIST_PATTERNS = 'blacklist/patterns ' ;
18
+
21
19
/**
22
20
* @var Config
23
21
*/
@@ -26,7 +24,8 @@ class IsBlacklisted implements IsBlacklistedInterface
26
24
/**
27
25
* @param Config $config
28
26
*/
29
- public function __construct (Config $ config ) {
27
+ public function __construct (Config $ config )
28
+ {
30
29
$ this ->config = $ config ;
31
30
}
32
31
@@ -38,7 +37,7 @@ public function __construct(Config $config) {
38
37
*/
39
38
public function execute (string $ path ): bool
40
39
{
41
- foreach ($ this ->config ->get (' blacklist/patterns ' ) as $ pattern ) {
40
+ foreach ($ this ->config ->get (self :: XML_PATH_BLACKLIST_PATTERNS ) as $ pattern ) {
42
41
if (empty ($ pattern )) {
43
42
continue ;
44
43
}
Original file line number Diff line number Diff line change 8
8
<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:module:Magento_MediaGallery:etc/directory.xsd" >
9
9
<blacklist >
10
10
<patterns >
11
- <pattern name =" captcha" >/pub\/media\/ captcha/</pattern >
12
- <pattern name =" catalog" >/pub\/media\/ catalog\/product/</pattern >
13
- <pattern name =" customer" >/pub\/media\/ customer/</pattern >
14
- <pattern name =" downloadable" >/pub\/media\/ downloadable/</pattern >
15
- <pattern name =" import" >/pub\/media\/ import/</pattern >
16
- <pattern name =" theme" >/pub\/media\/ theme/</pattern >
17
- <pattern name =" theme_customization" >/pub\/media\/ theme_customization/</pattern >
18
- <pattern name =" tmp" >/pub\/media\/ tmp/</pattern >
11
+ <pattern name =" captcha" >/^ captcha/</pattern >
12
+ <pattern name =" catalog" >/^ catalog\/product/</pattern >
13
+ <pattern name =" customer" >/^ customer/</pattern >
14
+ <pattern name =" downloadable" >/^ downloadable/</pattern >
15
+ <pattern name =" import" >/^ import/</pattern >
16
+ <pattern name =" theme" >/^ theme/</pattern >
17
+ <pattern name =" theme_customization" >/^ theme_customization/</pattern >
18
+ <pattern name =" tmp" >/^ tmp/</pattern >
19
19
<pattern name =" directories-with-dots" >/^\./</pattern >
20
20
</patterns >
21
21
</blacklist >
You can’t perform that action at this time.
0 commit comments