1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 20:41:16 +02:00

Add PR #229 to fix processwire/processwire-issues#1586 sub-issue 1 in InputfieldFile file replacement logic

This commit is contained in:
pine3ree
2023-01-19 11:21:14 -05:00
committed by Ryan Cramer
parent a5869294fb
commit 4d27f2a9ea

View File

@@ -993,7 +993,12 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
}
$replaceFile = $this->value->getFile($replace);
if($replaceFile instanceof Pagefile) {
$this->processInputDeleteFile($replaceFile);
// $this->processInputDeleteFile($replaceFile);
// PR#229 to fix #1586:
if($replaceFile->basename !== $pagefile->basename) {
$this->processInputDeleteFile($replaceFile);
}
// ---
if(strtolower($pagefile->ext()) == strtolower($replaceFile->ext())) {
$this->value->rename($pagefile, $replaceFile->name);
}