aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/lib/Helper.php4
-rw-r--r--lib/private/Share/Share.php2
-rw-r--r--tests/lib/Share/ShareTest.php6
3 files changed, 8 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/Helper.php b/apps/files_sharing/lib/Helper.php
index b6fc139c33d..e4640f82eb6 100644
--- a/apps/files_sharing/lib/Helper.php
+++ b/apps/files_sharing/lib/Helper.php
@@ -126,7 +126,7 @@ class Helper {
$newHash = '';
if(\OC::$server->getHasher()->verify($password, $linkItem['share_with'], $newHash)) {
// Save item id in session for future requests
- \OC::$server->getSession()->set('public_link_authenticated', $linkItem['id']);
+ \OC::$server->getSession()->set('public_link_authenticated', (string) $linkItem['id']);
/**
* FIXME: Migrate old hashes to new hash format
@@ -156,7 +156,7 @@ class Helper {
else {
// not authenticated ?
if ( ! \OC::$server->getSession()->exists('public_link_authenticated')
- || \OC::$server->getSession()->get('public_link_authenticated') !== $linkItem['id']) {
+ || \OC::$server->getSession()->get('public_link_authenticated') !== (string)$linkItem['id']) {
return false;
}
}
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index b1ad71d347f..bcda779e733 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -2493,7 +2493,7 @@ class Share extends Constants {
}
if ( \OC::$server->getSession()->exists('public_link_authenticated')
- && \OC::$server->getSession()->get('public_link_authenticated') === $linkItem['id'] ) {
+ && \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) {
return true;
}
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index 339193e7ff2..42adee21d0c 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -990,7 +990,7 @@ class ShareTest extends \Test\TestCase {
* @param $item
*/
public function testCheckPasswordProtectedShare($expected, $item) {
- \OC::$server->getSession()->set('public_link_authenticated', 100);
+ \OC::$server->getSession()->set('public_link_authenticated', '100');
$result = \OCP\Share::checkPasswordProtectedShare($item);
$this->assertEquals($expected, $result);
}
@@ -1002,8 +1002,12 @@ class ShareTest extends \Test\TestCase {
array(true, array('share_with' => '')),
array(true, array('share_with' => '1234567890', 'share_type' => '1')),
array(true, array('share_with' => '1234567890', 'share_type' => 1)),
+ array(true, array('share_with' => '1234567890', 'share_type' => '3', 'id' => '100')),
+ array(true, array('share_with' => '1234567890', 'share_type' => 3, 'id' => '100')),
array(true, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 100)),
array(true, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 100)),
+ array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => '101')),
+ array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => '101')),
array(false, array('share_with' => '1234567890', 'share_type' => '3', 'id' => 101)),
array(false, array('share_with' => '1234567890', 'share_type' => 3, 'id' => 101)),
);