BUGFIX: Ensure ASSETS_PATH is respected

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@88281 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-10-07 22:03:53 +00:00 committed by Sam Minnee
parent 98dda12a9d
commit e21297ecc0
2 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,7 @@ class Image extends File {
* @return string
*/
function getTag() {
if(file_exists("../" . $this->Filename)) {
if(file_exists($this->FullPath)) {
$url = $this->URL();
$title = ($this->Title) ? $this->Title : $this->Filename;
@ -790,4 +790,4 @@ class Image_Uploader extends Controller {
}
}
?>
?>

View File

@ -422,14 +422,14 @@ class File extends DataObject {
}
function getFullPath() {
$baseFolder = Director::baseFolder();
$baseFolder = ASSETS_PATH;
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();
return substr(ASSETS_PATH, 0, strlen(ASSETS_PATH) - strlen(ASSETS_DIR)) . $this->getFilename();
}
}
@ -615,4 +615,4 @@ class File extends DataObject {
}
?>
?>