From: Tim Düsterhus Date: Wed, 9 Sep 2020 14:27:53 +0000 (+0200) Subject: Do not error out if assets are missing in StyleEditForm X-Git-Tag: 5.3.0_Beta_1~38 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1ecaac09343a196f0b335f28ee3b503466331956;p=GitHub%2FWoltLab%2FWCF.git Do not error out if assets are missing in StyleEditForm Resolves #3560 --- diff --git a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php index 9f1f8208ed..4bf634d3cf 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php @@ -138,13 +138,13 @@ class StyleEditForm extends StyleAddForm { $this->variables['overrideScssCustom'] = $tmp['custom']; } - if ($this->variables['pageLogo']) { + if ($this->variables['pageLogo'] && file_exists($this->style->getAssetPath().$this->variables['pageLogo'])) { $file = new UploadFile($this->style->getAssetPath().$this->variables['pageLogo'], basename($this->variables['pageLogo']), true, true, true); UploadHandler::getInstance()->registerFilesByField('pageLogo', [ $file, ]); } - if ($this->variables['pageLogoMobile']) { + if ($this->variables['pageLogoMobile'] && file_exists($this->style->getAssetPath().$this->variables['pageLogoMobile'])) { $file = new UploadFile($this->style->getAssetPath().$this->variables['pageLogoMobile'], basename($this->variables['pageLogoMobile']), true, true, true); UploadHandler::getInstance()->registerFilesByField('pageLogoMobile', [ $file, @@ -185,19 +185,19 @@ class StyleEditForm extends StyleAddForm { $this->styleName = $this->style->styleName; $this->styleVersion = $this->style->styleVersion; $this->templateGroupID = $this->style->templateGroupID; - if ($this->style->image) { + if ($this->style->image && file_exists(WCF_DIR.'images/'.$this->style->image)) { $file = new UploadFile(WCF_DIR.'images/'.$this->style->image, $this->style->image, true, true, false); UploadHandler::getInstance()->registerFilesByField('image', [ $file, ]); } - if ($this->style->image2x) { + if ($this->style->image2x && file_exists(WCF_DIR.'images/'.$this->style->image2x)) { $file = new UploadFile(WCF_DIR.'images/'.$this->style->image2x, $this->style->image2x, true, true, false); UploadHandler::getInstance()->registerFilesByField('image2x', [ $file, ]); } - if ($this->style->coverPhotoExtension) { + if ($this->style->coverPhotoExtension && file_exists($this->style->getCoverPhotoLocation())) { $file = new UploadFile($this->style->getCoverPhotoLocation(), $this->style->getCoverPhoto(), true, true, false); UploadHandler::getInstance()->registerFilesByField('coverPhoto', [ $file,