From 19da6e3128081baf58d4d291488a0ad09fb2c322 Mon Sep 17 00:00:00 2001 From: Hayden Smith Date: Tue, 12 Aug 2008 22:26:52 +0000 Subject: [PATCH] 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 --- filesystem/File.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/filesystem/File.php b/filesystem/File.php index 6c86e96c2..576b39dce 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -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() {