[Pkg-owncloud-commits] [owncloud] 18/73: Check blacklist when renaming files
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:09:00 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.0.10
in repository owncloud.
commit 95ef80e6dbcd6bed0e32eac6d7a7e1cb8d12553c
Author: Michael Gapczynski <mtgap at owncloud.com>
Date: Sat Aug 11 11:04:04 2012 -0400
Check blacklist when renaming files
---
lib/base.php | 1 +
lib/filesystem.php | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/base.php b/lib/base.php
index 0e7e370..67f8e77 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -434,6 +434,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 2c7df5d..2a0c1ce 100644
--- a/lib/filesystem.php
+++ b/lib/filesystem.php
@@ -372,13 +372,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;
+ }
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list