Skip to content
Snippets Groups Projects
Commit 46576767 authored by Michael Gapczynski's avatar Michael Gapczynski
Browse files

Check blacklist when renaming files

parent 39b9052c
No related branches found
No related tags found
No related merge requests found
...@@ -362,6 +362,7 @@ class OC{ ...@@ -362,6 +362,7 @@ class OC{
// Check for blacklisted files // Check for blacklisted files
OC_Hook::connect('OC_Filesystem','write','OC_Filesystem','isBlacklisted'); 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 //make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper','cleanTmp')); register_shutdown_function(array('OC_Helper','cleanTmp'));
......
...@@ -363,13 +363,21 @@ class OC_Filesystem{ ...@@ -363,13 +363,21 @@ class OC_Filesystem{
/** /**
* checks if a file is blacklsited for storage in the filesystem * checks if a file is blacklsited for storage in the filesystem
* Listens to write and rename hooks
* @param array $data from hook * @param array $data from hook
*/ */
static public function isBlacklisted($data){ static public function isBlacklisted($data){
$blacklist = array('.htaccess'); $blacklist = array('.htaccess');
$filename = strtolower(basename($data['path'])); if (isset($data['path'])) {
if(in_array($filename,$blacklist)){ $path = $data['path'];
$data['run'] = false; } else if (isset($data['newpath'])) {
$path = $data['newpath'];
}
if (isset($path)) {
$filename = strtolower(basename($path));
if (in_array($filename, $blacklist)) {
$data['run'] = false;
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment