*/\r
public static function postUnshareAll( $params ) {\r
\r
-// $view = new \OC_FilesystemView( '/' );\r
-// $session = new Session();\r
-// $userId = \OCP\User::getUser();\r
-// $util = new Util( $view, $userId );\r
-// $path = $util->fileIdToPath( $params['itemSource'] );\r
-// \r
-// return Crypt::updateKeyfile( $view, $util, $session, $userId, $path );\r
+ // NOTE: It appears that this is never called for files, so \r
+ // we may not need to implement it\r
\r
}\r
\r
$split = explode( '/', $trimmed );
$sliced = array_slice( $split, 2 );
$relPath = implode( '/', $sliced );
+ $filePath = $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/'. $relPath;
if ( $view->is_dir( $path ) ) {
// Dirs must be handled separately as deleteFileKey
// doesn't handle them
- $view->unlink( $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/'. $relPath );
+ $view->unlink( $filePath );
} else {
- // Delete keyfile so it isn't orphaned
- $result = Keymanager::deleteFileKey( $view, $userId, $relPath );
-
- \OC_FileProxy::$enabled = true;
+ // Delete keyfile & shareKey so it isn't orphaned
+ if (
+ ! (
+ Keymanager::deleteFileKey( $view, $userId, $relPath )
+ && Keymanager::delShareKey( $view, $userId, $relPath )
+ )
+ ) {
+
+ \OC_Log::write( 'Encryption library', 'Keyfile or shareKey could not be deleted for file "'.$filePath.'"', \OC_Log::ERROR );
+
+
+ }
+
- return $result;
}
+
+ \OC_FileProxy::$enabled = true;
+
+ // If we don't return true then file delete will fail; better
+ // to leave orphaned keyfiles than to disallow file deletion
+ return true;
}
# Bugs
# ----
# Sharing a file to a user without encryption set up will not provide them with access but won't notify the sharer
-# Deleting files if keyfile is missing fails
# When encryption app is disabled files become unreadable
# Timeouts on first login due to encryption of very large files
-# MultiKeyEncrypt() may be failing
# Missing features
# ----------------
-# Unshare a file
# Re-use existing keyfiles so they don't need version control
# Make sure user knows if large files weren't encrypted
# Trashbin support