]> source.dussan.org Git - nextcloud-server.git/commitdiff
Perform expiration date checking before returning share data for token.
authorAndreas Fischer <bantu@owncloud.com>
Sat, 14 Sep 2013 16:44:28 +0000 (18:44 +0200)
committerAndreas Fischer <bantu@owncloud.com>
Wed, 9 Oct 2013 11:25:43 +0000 (13:25 +0200)
lib/public/share.php

index 0a88ea4ea441594c0b3f4104a204934b34ec96fa..ea4116eaa76cdda0a21ec684b903f70ad59c50b0 100644 (file)
@@ -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;
        }
 
        /**