mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 14:05:56 +02:00
Only return DMSDocument->FullPath() when filename exists
Fixes a regression introduced with 18c2081b
when uploading new files
This commit is contained in:
parent
597e393630
commit
6b7ee0623a
@ -374,7 +374,11 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||
* @return string
|
||||
*/
|
||||
function getFullPath() {
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user