mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix File::getRelativePath() failing if parent folder is renamed
Fixes #4993
This commit is contained in:
parent
cbdaf890dd
commit
5f8356d686
@ -743,7 +743,9 @@ class File extends DataObject {
|
|||||||
if($this->ParentID) {
|
if($this->ParentID) {
|
||||||
// Don't use the cache, the parent has just been changed
|
// Don't use the cache, the parent has just been changed
|
||||||
$p = DataObject::get_by_id('Folder', $this->ParentID, false);
|
$p = DataObject::get_by_id('Folder', $this->ParentID, false);
|
||||||
if($p && $p->exists()) return $p->getRelativePath() . $this->getField("Name");
|
if($p && $p->isInDB()) {
|
||||||
|
return $p->getRelativePath() . $this->getField("Name");
|
||||||
|
}
|
||||||
else return ASSETS_DIR . "/" . $this->getField("Name");
|
else return ASSETS_DIR . "/" . $this->getField("Name");
|
||||||
} else if($this->getField("Name")) {
|
} else if($this->getField("Name")) {
|
||||||
return ASSETS_DIR . "/" . $this->getField("Name");
|
return ASSETS_DIR . "/" . $this->getField("Name");
|
||||||
|
Loading…
Reference in New Issue
Block a user