Skip to content

Commit f66460a

Browse files
committed
[FEATURE][DOBO-786] Make sure that only image filetypes are processed by Gd2
1 parent a35b7c1 commit f66460a

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

Helper/Settings.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,27 @@ public function getConfigValue($path)
8888
);
8989
}
9090

91+
92+
/**
93+
* This is used for the Gd2
94+
*
95+
* @return array
96+
*/
97+
public function getImageFiletypes()
98+
{
99+
return [
100+
'jpg',
101+
'jpeg',
102+
'png',
103+
'gif',
104+
'webp',
105+
'bmp',
106+
'xpm',
107+
'xbm',
108+
'wbmp'
109+
];
110+
}
111+
91112
/**
92113
* Get extra file types (allowed)
93114
*

Image/Adapter/Gd2.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function __construct(
3131
array $data = []
3232
) {
3333
$this->settings = $helperSettings;
34-
3534
parent::__construct($filesystem, $logger, $data);
3635
}
3736

@@ -46,7 +45,7 @@ public function open($filename)
4645
{
4746
$pathInfo = pathinfo($filename);
4847
if (key_exists('extension', $pathInfo)
49-
&& in_array($pathInfo['extension'], $this->settings->getExtraFiletypes())
48+
&& in_array($pathInfo['extension'], $this->settings->getImageFiletypes())
5049
) {
5150
parent::open($filename);
5251
}
@@ -66,7 +65,7 @@ public function save($destination = null, $newName = null)
6665
$fileName = $this->_prepareDestination($destination, $newName);
6766
$pathInfo = pathinfo($fileName);
6867
if (key_exists('extension', $pathInfo)
69-
&& in_array($pathInfo['extension'], $this->settings->getExtraFiletypes())
68+
&& in_array($pathInfo['extension'], $this->settings->getImageFiletypes())
7069
) {
7170
parent::save($destination, $newName);
7271
}

0 commit comments

Comments
 (0)