Skip to content
Snippets Groups Projects
Commit e1db658c authored by Xavier Perseguers's avatar Xavier Perseguers Committed by Christian Kuhn
Browse files

[BUGFIX] Cannot upload an extension as zip

The file extension ".zip" should be systematically removed when
extracting the extension key from the uploaded file name.

Fixes: #52178
Releases: 6.2, 6.1, 6.0
Change-Id: I5316b995533fa324d3b19407ad9bb6365ab8858b
Reviewed-on: https://review.typo3.org/24037
Reviewed-by: Sebastian Fischer
Tested-by: Sebastian Fischer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent b5d5ff9e
No related merge requests found
......@@ -137,7 +137,7 @@ class UploadExtensionFileController extends \TYPO3\CMS\Extensionmanager\Controll
*/
protected function getExtensionFromZipFile($file, $fileName, $overwrite = FALSE) {
// Remove version and ending from filename to determine extension key
$extensionKey = preg_replace('/_(\d+)(\.|\-)(\d+)(\.|\-)(\d+).*/i', '', strtolower($fileName));
$extensionKey = preg_replace('/_(\d+)(\.|\-)(\d+)(\.|\-)(\d+).*/i', '', strtolower(substr($fileName, 0, -4)));
if (!$overwrite && $this->installUtility->isAvailable($extensionKey)) {
throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Extension is already available and overwriting is disabled.', 1342864311);
}
......
......@@ -58,6 +58,10 @@ class UploadExtensionFileControllerTest extends \TYPO3\CMS\Extbase\Tests\Unit\Ba
'characters after version with extra space' => array(
'extension_1-2-3 (1).zip',
'extension'
),
'no version' => array(
'extension.zip',
'extension'
)
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment