aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@owncloud.com>2013-09-23 15:12:38 +0200
committerAndreas Fischer <bantu@owncloud.com>2013-09-23 15:12:38 +0200
commit437858852c039ba7fef7e6cf2a4a2e9dae68c1a2 (patch)
tree8ab405d33f7000ccede7dda359f490e4f7c4dbc1 /lib
parent9851f0f4f2a97dc6ac1382bcd533eb23feffa4e0 (diff)
parenta92d4c2c0932f5c662ed846763e3059ebdcde07c (diff)
downloadnextcloud-server-437858852c039ba7fef7e6cf2a4a2e9dae68c1a2.tar.gz
nextcloud-server-437858852c039ba7fef7e6cf2a4a2e9dae68c1a2.zip
Merge pull request #4856 from owncloud/fix-link-expiration
Fix Sharing "Expiration Date" for Shares of type Link (i.e. Token) * owncloud/fix-link-expiration: Perform expiration date checking before returning share data for token. Tests whether expired/valid link share is still accessible.
Diffstat (limited to 'lib')
-rw-r--r--lib/public/share.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 91b0ef6dc69..7a8a183574b 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -293,7 +293,18 @@ class Share {
if (\OC_DB::isError($result)) {
\OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', token=' . $token, \OC_Log::ERROR);
}
- return $result->fetchRow();
+ $row = $result->fetchRow();
+
+ if (!empty($row['expiration'])) {
+ $now = new \DateTime();
+ $expirationDate = new \DateTime($row['expiration'], new \DateTimeZone('UTC'));
+ if ($now > $expirationDate) {
+ self::delete($row['id']);
+ return false;
+ }
+ }
+
+ return $row;
}
/**