diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-05-22 14:42:57 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-05-22 14:42:57 +0200 |
commit | 41a8f45b93a55fe3e72f0700c15ac04db498d839 (patch) | |
tree | 584797106a1721153fdb4083630219aa33fc7ece /apps/files_sharing/api | |
parent | b82d902e184960877110bc45124ed2399f779cac (diff) | |
download | nextcloud-server-41a8f45b93a55fe3e72f0700c15ac04db498d839.tar.gz nextcloud-server-41a8f45b93a55fe3e72f0700c15ac04db498d839.zip |
OCS Share API link shares now always have an url
To make sure clients have the correct and latest link add an url field
to all OCS Share API return statements on public link shares.
* Added unit tests
Diffstat (limited to 'apps/files_sharing/api')
-rw-r--r-- | apps/files_sharing/api/local.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_sharing/api/local.php b/apps/files_sharing/api/local.php index 03812800c17..706cac24ff9 100644 --- a/apps/files_sharing/api/local.php +++ b/apps/files_sharing/api/local.php @@ -70,6 +70,10 @@ class Local { } $share['icon'] = substr(\OC_Helper::mimetypeIcon($share['mimetype']), 0, -3) . 'svg'; } + + if (!is_null($share['token'])) { + $share['url'] = \OC::$server->getURLGenerator()->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share['token']]); + } } return new \OC_OCS_Result($shares); } @@ -142,6 +146,12 @@ class Local { if ($shares === null || empty($shares)) { return new \OC_OCS_Result(null, 404, 'share doesn\'t exist'); } else { + foreach ($shares as &$share) { + if (!is_null($share['token'])) { + $share['url'] = \OC::$server->getURLGenerator()->linkToRouteAbsolute('files_sharing.sharecontroller.showShare', ['token' => $share['token']]); + } + } + return new \OC_OCS_Result($shares); } } |