aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-29 17:54:04 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-29 17:54:04 +0100
commitb1d8d88df85030bd8c539307fab11db131732558 (patch)
treec22ff1323da36ab7aba867b0cd64c2ac61f9e3e7 /lib/private/share
parent5c8e5e223d07780196680732544fa66a5fa2503c (diff)
parent333f4e7913ff8085f46f80db5bf1224fb1cd6e0c (diff)
downloadnextcloud-server-b1d8d88df85030bd8c539307fab11db131732558.tar.gz
nextcloud-server-b1d8d88df85030bd8c539307fab11db131732558.zip
Merge pull request #13760 from owncloud/create_enc_key_for_remote_shares
make sure that we always create a public share key for remote shares
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/share.php36
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index b2c84e39044..bd21bdd4b3a 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -103,6 +103,7 @@ class Share extends \OC\Share\Constants {
$shares = $sharePaths = $fileTargets = array();
$publicShare = false;
+ $remoteShare = false;
$source = -1;
$cache = false;
@@ -170,18 +171,16 @@ class Share extends \OC\Share\Constants {
//check for public link shares
if (!$publicShare) {
- $query = \OC_DB::prepare(
- 'SELECT `share_with`
- FROM
- `*PREFIX*share`
- WHERE
- `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')'
+ $query = \OC_DB::prepare('
+ SELECT `share_with`
+ FROM `*PREFIX*share`
+ WHERE `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')', 1
);
$result = $query->execute(array($source, self::SHARE_TYPE_LINK));
if (\OCP\DB::isError($result)) {
- \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OC_Log::ERROR);
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
if ($result->fetchRow()) {
$publicShare = true;
@@ -189,6 +188,25 @@ class Share extends \OC\Share\Constants {
}
}
+ //check for remote share
+ if (!$remoteShare) {
+ $query = \OC_DB::prepare('
+ SELECT `share_with`
+ FROM `*PREFIX*share`
+ WHERE `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')', 1
+ );
+
+ $result = $query->execute(array($source, self::SHARE_TYPE_REMOTE));
+
+ if (\OCP\DB::isError($result)) {
+ \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
+ } else {
+ if ($result->fetchRow()) {
+ $remoteShare = true;
+ }
+ }
+ }
+
// let's get the parent for the next round
$meta = $cache->get((int)$source);
if($meta !== false) {
@@ -234,7 +252,7 @@ class Share extends \OC\Share\Constants {
return $sharePaths;
}
- return array("users" => array_unique($shares), "public" => $publicShare);
+ return array('users' => array_unique($shares), 'public' => $publicShare, 'remote' => $remoteShare);
}
/**
@@ -2281,7 +2299,7 @@ class Share extends \OC\Share\Constants {
if ($user && $remote) {
$url = $remote . self::BASE_PATH_TO_SHARE_API . '?format=' . self::RESPONSE_FORMAT;
- $local = \OC::$server->getURLGenerator()->getAbsoluteURL('');
+ $local = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
$fields = array(
'shareWith' => $user,