From decb1f64e9f423d2d99df34bf3c3af3259334114 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 25 Oct 2024 11:24:34 +0200 Subject: [PATCH] Fix the resolution of the path on Windows See https://www.woltlab.com/community/thread/309045/ --- .../files/lib/system/file/upload/UploadFile.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php b/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php index 590beafc0f..90c163df17 100644 --- a/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php +++ b/wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php @@ -140,8 +140,14 @@ class UploadFile if ($this->processed) { if ($this->imageLink === null) { - // try to guess path - $link = \str_replace(WCF_DIR, WCF::getPath(), $this->location); + $corePath = FileUtil::unifyDirSeparator(\WCF_DIR); + $location = FileUtil::unifyDirSeparator($this->location); + + if (\str_starts_with($location, $corePath)) { + $link = WCF::getPath() . \mb_substr($location, \mb_strlen($corePath)); + } else { + $link = $location; + } } else { $link = $this->imageLink; } -- 2.20.1