Skip to content
Snippets Groups Projects
Commit 7b07168c authored by Björn Schießle's avatar Björn Schießle
Browse files

code clean up; nicer solution to solve the public link share problem if a user is logged in

parent a9ebf2aa
No related branches found
No related tags found
No related merge requests found
...@@ -238,14 +238,10 @@ class Keymanager ...@@ -238,14 +238,10 @@ class Keymanager
$util = new Util($view, \OCP\User::getUser()); $util = new Util($view, \OCP\User::getUser());
if ($util->isPublic()) { list($owner, $filename) = $util->getUidAndFilename($filePath);
$keyfilePath = $util->getKeyfilePath() . $filePath . '.key'; $filePath_f = ltrim($filename, '/');
} else {
list($owner, $filename) = $util->getUidAndFilename($filePath);
$filePath_f = ltrim($filename, '/');
$keyfilePath = '/' . $owner . '/files_encryption/keyfiles/' . $filePath_f . '.key'; $keyfilePath = '/' . $owner . '/files_encryption/keyfiles/' . $filePath_f . '.key';
}
$proxyStatus = \OC_FileProxy::$enabled; $proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false; \OC_FileProxy::$enabled = false;
...@@ -452,12 +448,8 @@ class Keymanager ...@@ -452,12 +448,8 @@ class Keymanager
//here we need the currently logged in user, while userId can be a different user //here we need the currently logged in user, while userId can be a different user
$util = new Util($view, \OCP\User::getUser()); $util = new Util($view, \OCP\User::getUser());
if ($util->isPublic()) { list($owner, $filename) = $util->getUidAndFilename($filePath);
$shareKeyPath = $util->getSharekeyPath() . $filePath . '.' . $userId . '.shareKey'; $shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey');
} else {
list($owner, $filename) = $util->getUidAndFilename($filePath);
$shareKeyPath = \OC\Files\Filesystem::normalizePath('/' . $owner . '/files_encryption/share-keys/' . $filename . '.' . $userId . '.shareKey');
}
if ($view->file_exists($shareKeyPath)) { if ($view->file_exists($shareKeyPath)) {
......
...@@ -1139,7 +1139,7 @@ class Util ...@@ -1139,7 +1139,7 @@ class Util
$fileOwnerUid = $view->getOwner($path); $fileOwnerUid = $view->getOwner($path);
// handle public access // handle public access
if ($fileOwnerUid === false && $this->isPublic) { if ($this->isPublic) {
$filename = $path; $filename = $path;
$fileOwnerUid = $GLOBALS['fileOwner']; $fileOwnerUid = $GLOBALS['fileOwner'];
...@@ -1494,15 +1494,4 @@ class Util ...@@ -1494,15 +1494,4 @@ class Util
$this->recoverAllFiles('/', $privateKey); $this->recoverAllFiles('/', $privateKey);
} }
public function isPublic() {
return $this->isPublic;
}
public function getKeyfilePath() {
return $this->keyfilesPath;
}
public function getSharekeyPath() {
return $this->shareKeysPath;
}
} }
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