Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Share/Helper/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ public function formatShare(IShare $share): array {
* @param IShare $share
* @param string $shareWith
* @param int $permissions
* @param string $expireDate
* @param ?string $expireDate
* @throws OCSNotFoundException
*/
public function createShare(IShare $share, string $shareWith, int $permissions, string $expireDate): void {
public function createShare(IShare $share, string $shareWith, int $permissions, ?string $expireDate = null): void {
$share->setSharedWith($shareWith);
$share->setPermissions($permissions);

if ($expireDate !== '') {
if ($expireDate !== null && $expireDate !== '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty returns true for both null and empty string ('').

Suggested change
if ($expireDate !== null && $expireDate !== '') {
if (!empty($expireDate)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I wanted to keep it separated to explicitly show 2 different cases, because '' and null have different semantics here

try {
$expireDateTime = $this->parseDate($expireDate);
$share->setExpirationDate($expireDateTime);
Expand Down