Skip to content

Commit fee82ad

Browse files
committed
fix(files_reminder): prevent setting reminder in the past
Signed-off-by: skjnldsv <[email protected]>
1 parent 2d9d612 commit fee82ad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/files_reminders/lib/Controller/ApiController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public function get(int $fileId): DataResponse {
8282
public function set(int $fileId, string $dueDate): DataResponse {
8383
try {
8484
$dueDate = (new DateTime($dueDate))->setTimezone(new DateTimeZone('UTC'));
85+
$nowDate = (new DateTime('now'))->setTimezone(new DateTimeZone('UTC'));
86+
if ($dueDate <= $nowDate) {
87+
return new DataResponse([], Http::STATUS_BAD_REQUEST);
88+
}
8589
} catch (Exception $e) {
8690
$this->logger->error($e->getMessage(), ['exception' => $e]);
8791
return new DataResponse([], Http::STATUS_BAD_REQUEST);

0 commit comments

Comments
 (0)