Check whether the media file is readable in MediaImporter
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 28 Apr 2021 08:48:33 +0000 (10:48 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 28 Apr 2021 08:48:33 +0000 (10:48 +0200)
wcfsetup/install/files/lib/system/importer/MediaImporter.class.php

index 1170d65d6a890fa92c14c8f0a42feec4a2c0d3f6..04de79079e1a935fc454b9d4b7d11fbcc3ccf1ab 100644 (file)
@@ -14,7 +14,7 @@ use wcf\system\WCF;
  * Imports cms media.
  *
  * @author  Marcel Werk
- * @copyright   2001-2019 WoltLab GmbH
+ * @copyright   2001-2021 WoltLab GmbH
  * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package WoltLabSuite\Core\System\Importer
  */
@@ -35,6 +35,11 @@ class MediaImporter extends AbstractImporter
      */
     public function import($oldID, array $data, array $additionalData = [])
     {
+        // check file location
+        if (!\is_readable($additionalData['fileLocation'])) {
+            return 0;
+        }
+
         $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
 
         $contents = [];