]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check the expiration date for null
authorMorris Jobke <hey@morrisjobke.de>
Tue, 1 Dec 2015 16:43:05 +0000 (17:43 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Fri, 4 Dec 2015 14:03:52 +0000 (15:03 +0100)
* null is always less than any value -> expirationDate gets null
  which is "no date set"
* ref https://github.com/owncloud/core/issues/20590#issuecomment-158393075

lib/private/share/share.php

index 4dd92ac816e87863765a31b43d533c247c62e737..c569a957df74bae30f1ab46bcb42cf29da6b9e74 100644 (file)
@@ -2166,7 +2166,13 @@ class Share extends Constants {
                                } else {
                                        // TODO Don't check if inside folder
                                        $result['parent'] = $checkReshare['id'];
-                                       $result['expirationDate'] = min($expirationDate, $checkReshare['expiration']);
+
+                                       $result['expirationDate'] = $expirationDate;
+                                       // $checkReshare['expiration'] could be null and then is always less than any value
+                                       if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
+                                               $result['expirationDate'] = $checkReshare['expiration'];
+                                       }
+
                                        // only suggest the same name as new target if it is a reshare of the
                                        // same file/folder and not the reshare of a child
                                        if ($checkReshare[$column] === $itemSource) {