Skip to content
Permalink
Browse files

BUG Fix File::getRelativePath() failing if parent folder is renamed

Fixes #4993
  • Loading branch information...
Damian Mooyman
Damian Mooyman committed Mar 21, 2016
1 parent cbdaf89 commit 5f8356d6868be9035c4b2a4d00d04c14ab34e4e4
Showing with 3 additions and 1 deletion.
  1. +3 −1 filesystem/File.php
@@ -743,7 +743,9 @@ public function getRelativePath() {
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");

0 comments on commit 5f8356d

Please sign in to comment.
You can’t perform that action at this time.