Only return DMSDocument->FullPath() when filename exists

Fixes a regression introduced with 18c2081b when uploading new files
This commit is contained in:
Ingo Schommer 2013-01-07 17:31:04 +01:00
parent 597e393630
commit 6b7ee0623a

View File

@ -374,7 +374,11 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
* @return string * @return string
*/ */
function getFullPath() { 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); DMSDocument_versions::create_version($this);
} else { //otherwise delete the old document file } else { //otherwise delete the old document file
$oldPath = $this->getFullPath(); $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) copy($fromPath, $toPath); //this will overwrite the existing file (if present)