mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
339c580aee
commit
19da6e3128
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user