summaryrefslogtreecommitdiffstats
path: root/lib/private/share
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-04-29 10:52:43 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-04-29 10:52:43 +0200
commit8c7db2536dc1107bca6b427af25d713a97c0be96 (patch)
tree48442dc437f5855d708f22baa8e24d0ae4c86611 /lib/private/share
parent7df7a3b3602cd3a733c79255cee95ce324f729fa (diff)
parentb55ef51a27e73a30e0829e273cdf111e21a77403 (diff)
downloadnextcloud-server-8c7db2536dc1107bca6b427af25d713a97c0be96.tar.gz
nextcloud-server-8c7db2536dc1107bca6b427af25d713a97c0be96.zip
Merge pull request #15596 from owncloud/issue/15589
Correctly generate the feedback URL for remote share
Diffstat (limited to 'lib/private/share')
-rw-r--r--lib/private/share/share.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 0991fa0f38a..38f763bfe87 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -2395,15 +2395,17 @@ class Share extends Constants {
*
* @param string $url
* @param array $fields post parameters
- * @return bool
+ * @return array
*/
private static function tryHttpPost($url, $fields) {
$protocol = 'https://';
- $success = false;
+ $result = [
+ 'success' => false,
+ 'result' => '',
+ ];
$try = 0;
- while ($success === false && $try < 2) {
+ while ($result['success'] === false && $try < 2) {
$result = \OC::$server->getHTTPHelper()->post($protocol . $url, $fields);
- $success = $result['success'];
$try++;
$protocol = 'http://';
}
@@ -2426,7 +2428,7 @@ class Share extends Constants {
list($user, $remote) = explode('@', $shareWith, 2);
if ($user && $remote) {
- $url = $remote . self::BASE_PATH_TO_SHARE_API . '?format=' . self::RESPONSE_FORMAT;
+ $url = rtrim($remote, '/') . self::BASE_PATH_TO_SHARE_API . '?format=' . self::RESPONSE_FORMAT;
$local = \OC::$server->getURLGenerator()->getAbsoluteURL('/');
@@ -2459,8 +2461,9 @@ class Share extends Constants {
* @return bool
*/
private static function sendRemoteUnshare($remote, $id, $token) {
- $url = $remote . self::BASE_PATH_TO_SHARE_API . '/' . $id . '/unshare?format=' . self::RESPONSE_FORMAT;
+ $url = rtrim($remote, '/') . self::BASE_PATH_TO_SHARE_API . '/' . $id . '/unshare?format=' . self::RESPONSE_FORMAT;
$fields = array('token' => $token, 'format' => 'json');
+ $url = self::removeProtocolFromUrl($url);
$result = self::tryHttpPost($url, $fields);
$status = json_decode($result['result'], true);