mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #5215 from tractorcow/pulls/3.2/fix-folder-relativepath
BUG Fix File::getRelativePath() failing if parent folder is renamed
This commit is contained in:
commit
d2fa01fb17
@ -743,7 +743,9 @@ class File extends DataObject {
|
||||
if($this->ParentID) {
|
||||
// Don't use the cache, the parent has just been changed
|
||||
$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 if($this->getField("Name")) {
|
||||
return ASSETS_DIR . "/" . $this->getField("Name");
|
||||
|
Loading…
Reference in New Issue
Block a user