So I've set up a new product in my Magento storefront. All works fine, however when I try to upload an image to the product I'm getting this error:
Could not read config file
I've checked the folder where the image would be uploaded to and it is actually there so it's been uploaded, but can't actually save the image.
I've tried to debug it and it seems the problem is in the FileResolver.php
file in this method:
public function get($filename, $scope)
{
switch ($scope) {
case 'global':
$iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray();
$themeConfigFile = $this->currentTheme->getCustomization()->getCustomViewConfigPath();
if ($themeConfigFile
&& $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
) {
$iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] =
$this->rootDirectory->readFile(
$this->rootDirectory->getRelativePath(
$themeConfigFile
)
);
} else {
$designPath = $this->resolver->resolve(
RulePool::TYPE_FILE,
'etc/view.xml',
$this->area,
$this->currentTheme
);
if (file_exists($designPath)) {
try {
$designDom = new \DOMDocument;
$designDom->load($designPath);
$iterator[$designPath] = $designDom->saveXML();
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(
new \Magento\Framework\Phrase('Could not read config file')
);
}
}
}
break;
default:
$iterator = $this->iteratorFactory->create([]);
break;
}
return $iterator;
}