From 6b7ee0623aad28257eb673294e9830a5070b3b8e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Mon, 7 Jan 2013 17:31:04 +0100 Subject: [PATCH] Only return DMSDocument->FullPath() when filename exists Fixes a regression introduced with 18c2081b when uploading new files --- code/DMSDocument.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/DMSDocument.php b/code/DMSDocument.php index e6cd915..24ff878 100755 --- a/code/DMSDocument.php +++ b/code/DMSDocument.php @@ -374,7 +374,11 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { * @return string */ function getFullPath() { - return DMS::get_dms_path() . DIRECTORY_SEPARATOR . $this->Folder . DIRECTORY_SEPARATOR . $this->Filename; + if($this->Filename) { + return DMS::get_dms_path() . DIRECTORY_SEPARATOR . $this->Folder . DIRECTORY_SEPARATOR . $this->Filename; + } else { + return false; + } } /** @@ -446,7 +450,7 @@ class DMSDocument extends DataObject implements DMSDocumentInterface { DMSDocument_versions::create_version($this); } else { //otherwise delete the old document file $oldPath = $this->getFullPath(); - if (file_exists($oldPath)) unlink($this->getFullPath()); + if (file_exists($oldPath)) unlink($oldPath); } copy($fromPath, $toPath); //this will overwrite the existing file (if present)