Skip to content

Commit decb1f6

Browse files
committed
Fix the resolution of the path on Windows
See https://www.woltlab.com/community/thread/309045/
1 parent 090ae94 commit decb1f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

wcfsetup/install/files/lib/system/file/upload/UploadFile.class.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,14 @@ public function getImage()
140140

141141
if ($this->processed) {
142142
if ($this->imageLink === null) {
143-
// try to guess path
144-
$link = \str_replace(WCF_DIR, WCF::getPath(), $this->location);
143+
$corePath = FileUtil::unifyDirSeparator(\WCF_DIR);
144+
$location = FileUtil::unifyDirSeparator($this->location);
145+
146+
if (\str_starts_with($location, $corePath)) {
147+
$link = WCF::getPath() . \mb_substr($location, \mb_strlen($corePath));
148+
} else {
149+
$link = $location;
150+
}
145151
} else {
146152
$link = $this->imageLink;
147153
}

0 commit comments

Comments
 (0)