Refactored [47088]: File::getFullPath now compares the filename with Director::baseFolder and returns filename if the filename stars with Director::baseFolder.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60529 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Hayden Smith 2008-08-12 22:26:52 +00:00
parent 339c580aee
commit 19da6e3128

View File

@ -356,7 +356,15 @@ class File extends DataObject {
}
function getFullPath() {
return Director::baseFolder() . '/' . $this->getFilename();
$baseFolder = Director::baseFolder();
if(strpos($this->getFilename(), $baseFolder) === 0) {
// if path is absolute already, just return
return $this->getFilename();
} else {
// otherwise assume silverstripe-basefolder
return Director::baseFolder() . '/' . $this->getFilename();
}
}
function getRelativePath() {