]> source.dussan.org Git - nextcloud-server.git/commitdiff
check not only if the keyfile folder exists but also if it contains keyfiles
authorBjoern Schiessle <schiessle@owncloud.com>
Fri, 27 Sep 2013 11:34:48 +0000 (13:34 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Fri, 27 Sep 2013 11:34:48 +0000 (13:34 +0200)
lib/util.php

index 41f5f1d16be3164c29e0a293a9ae8af2a67677d5..dd6c72bfc7f85e8967f8673466a99b36698bdf93 100755 (executable)
@@ -410,14 +410,18 @@ class OC_Util {
                $encryptedFiles = false;
                if (OC_App::isEnabled('files_encryption') === false) {
                        $view = new OC\Files\View('/' . OCP\User::getUser());
-                       if ($view->file_exists('/files_encryption/keyfiles')) {
-                               $encryptedFiles = true;
+                       $keyfilePath = '/files_encryption/keyfiles';
+                       if ($view->is_dir($keyfilePath)) {
+                               $dircontent = $view->getDirectoryContent($keyfilePath);
+                               if (!empty($dircontent)) {
+                                       $encryptedFiles = true;
+                               }
                        }
                }
-               
+
                return $encryptedFiles;
        }
-       
+
        /**
         * @brief Check for correct file permissions of data directory
         * @paran string $dataDirectory
@@ -654,16 +658,16 @@ class OC_Util {
                }
                return $value;
        }
-       
+
        /**
         * @brief Public function to encode url parameters
         *
         * This function is used to encode path to file before output.
         * Encoding is done according to RFC 3986 with one exception:
-        * Character '/' is preserved as is. 
+        * Character '/' is preserved as is.
         *
         * @param string $component part of URI to encode
-        * @return string 
+        * @return string
         */
        public static function encodePath($component) {
                $encoded = rawurlencode($component);
@@ -810,7 +814,7 @@ class OC_Util {
                        }
                }
        }
-       
+
        /**
         * @brief Check if the connection to the internet is disabled on purpose
         * @return bool