aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-04-21 12:20:21 -0400
committerCash Costello <cash.costello@gmail.com>2013-04-21 12:20:21 -0400
commit6f3df999223874592b6cf4f8399b5f9a3fa5bbd1 (patch)
tree7dab2d20070e28c9ef8f3b2b8d470846f7167f28 /engine/classes
parented99f7b064a0749603f16644ba735de7ba93c17e (diff)
downloadelgg-6f3df999223874592b6cf4f8399b5f9a3fa5bbd1.tar.gz
elgg-6f3df999223874592b6cf4f8399b5f9a3fa5bbd1.tar.bz2
Fixes #5207 returning false if filename is not set
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggDiskFilestore.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/engine/classes/ElggDiskFilestore.php b/engine/classes/ElggDiskFilestore.php
index 663d33c02..6e2354012 100644
--- a/engine/classes/ElggDiskFilestore.php
+++ b/engine/classes/ElggDiskFilestore.php
@@ -194,7 +194,9 @@ class ElggDiskFilestore extends ElggFilestore {
}
/**
- * Returns the filename as saved on disk for an ElggFile object
+ * Get the filename as saved on disk for an ElggFile object
+ *
+ * Returns an empty string if no filename set
*
* @param ElggFile $file File object
*
@@ -213,7 +215,12 @@ class ElggDiskFilestore extends ElggFilestore {
throw new InvalidParameterException($msg);
}
- return $this->dir_root . $this->makeFileMatrix($owner_guid) . $file->getFilename();
+ $filename = $file->getFilename();
+ if (!$filename) {
+ return '';
+ }
+
+ return $this->dir_root . $this->makeFileMatrix($owner_guid) . $filename;
}
/**
@@ -221,7 +228,7 @@ class ElggDiskFilestore extends ElggFilestore {
*
* @param ElggFile $file File object
*
- * @return mixed
+ * @return string
*/
public function grabFile(ElggFile $file) {
return file_get_contents($file->getFilenameOnFilestore());
@@ -235,6 +242,9 @@ class ElggDiskFilestore extends ElggFilestore {
* @return bool
*/
public function exists(ElggFile $file) {
+ if (!$file->getFilename()) {
+ return false;
+ }
return file_exists($this->getFilenameOnFilestore($file));
}