diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 10:14:05 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-05-20 10:14:05 +0300 |
commit | 0c231f5ac65b22654ea6a41b96eaa5422119cb42 (patch) | |
tree | 1d991db9c051b3e51d2baf255b4e0800a3e380d3 /lib | |
parent | 7015dd74ce27db6e7c7cb2596e61343ac9f22902 (diff) | |
parent | 5733878d6657c6e02ba3ded9e7eab4a9ba3dafe3 (diff) |
Merge pull request #15959 from owncloud/backport-15596-remote-share-feedback-urls
Backport 15596 remote share feedback urls
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/share/share.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index a548698a61e..e52704be3d8 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -2289,15 +2289,17 @@ class Share extends \OC\Share\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://'; } @@ -2320,7 +2322,7 @@ class Share extends \OC\Share\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('/'); @@ -2353,8 +2355,9 @@ class Share extends \OC\Share\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); |