summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/base.php1
-rw-r--r--lib/filesystem.php14
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php
index 0730e5ff3a9..2cbce82677d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -362,6 +362,7 @@ class OC{
// Check for blacklisted files
OC_Hook::connect('OC_Filesystem','write','OC_Filesystem','isBlacklisted');
+ OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted');
//make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper','cleanTmp'));
diff --git a/lib/filesystem.php b/lib/filesystem.php
index 47626c05ae2..e9d2ae93372 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -363,13 +363,21 @@ class OC_Filesystem{
/**
* checks if a file is blacklsited for storage in the filesystem
+ * Listens to write and rename hooks
* @param array $data from hook
*/
static public function isBlacklisted($data){
$blacklist = array('.htaccess');
- $filename = strtolower(basename($data['path']));
- if(in_array($filename,$blacklist)){
- $data['run'] = false;
+ if (isset($data['path'])) {
+ $path = $data['path'];
+ } else if (isset($data['newpath'])) {
+ $path = $data['newpath'];
+ }
+ if (isset($path)) {
+ $filename = strtolower(basename($path));
+ if (in_array($filename, $blacklist)) {
+ $data['run'] = false;
+ }
}
}