Skip to content

Commit e158f0d

Browse files
committed
Fix #22 #20
1 parent b1eaea9 commit e158f0d

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<description>
88
<![CDATA[Files sharing use file stored path. Now you cau use nextcloud as your CDN origin.
99
What you need to do is just share your files, then click Open Sharing Path to access from files dropdown actions menu. ]]></description>
10-
<version>0.2.2</version>
10+
<version>0.2.3</version>
1111
<licence>agpl</licence>
1212
<author mail="[email protected]">Rookie0</author>
1313
<namespace>SharingPath</namespace>

lib/Controller/PathController.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public function __construct($appName,
4646
* @PublicPage
4747
* @NoAdminRequired
4848
* @NoCSRFRequired
49+
* @NoSameSiteCookieRequired
4950
*/
5051
public function index()
5152
{
@@ -63,6 +64,7 @@ public function index()
6364
* @PublicPage
6465
* @NoAdminRequired
6566
* @NoCSRFRequired
67+
* @NoSameSiteCookieRequired
6668
*/
6769
public function handle($uid, $path)
6870
{
@@ -159,10 +161,11 @@ private function isShared($uid, $path)
159161
$now = time();
160162
$shared = false;
161163
for ($i = $len; $i > 0; $i--) {
162-
$tmpPath = implode(DIRECTORY_SEPARATOR, array_slice($segments, 0, $i));
163-
$userPath = $this->rootFolder->getUserFolder($uid)->get($tmpPath);
164-
$shares = $this->shareManager->getSharesBy($uid, IShare::TYPE_LINK, $userPath);
165-
$share = $shares[0] ?? null;
164+
$tmpPath = implode(DIRECTORY_SEPARATOR, array_slice($segments, 0, $i));
165+
$userPath = $this->rootFolder->getUserFolder($uid)->get($tmpPath);
166+
$shareType = version_compare(\OC_Util::getVersionString(), '17.0.0', '>=') ? IShare::TYPE_LINK : OC\Share\Constants::SHARE_TYPE_LINK;
167+
$shares = $this->shareManager->getSharesBy($uid, $shareType, $userPath);
168+
$share = $shares[0] ?? null;
166169

167170
// shared but checked hide download or password protect or expired
168171
if ($share && (

0 commit comments

Comments
 (0)