From 1ecaac09343a196f0b335f28ee3b503466331956 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 9 Sep 2020 16:27:53 +0200 Subject: [PATCH] Do not error out if assets are missing in StyleEditForm Resolves #3560 --- .../install/files/lib/acp/form/StyleEditForm.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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, -- 2.20.1