mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(files_reminder): prevent setting reminder in the past
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
parent
2d9d612ec1
commit
fee82adad4
1 changed files with 4 additions and 0 deletions
|
|
@ -82,6 +82,10 @@ class ApiController extends OCSController {
|
|||
public function set(int $fileId, string $dueDate): DataResponse {
|
||||
try {
|
||||
$dueDate = (new DateTime($dueDate))->setTimezone(new DateTimeZone('UTC'));
|
||||
$nowDate = (new DateTime('now'))->setTimezone(new DateTimeZone('UTC'));
|
||||
if ($dueDate <= $nowDate) {
|
||||
return new DataResponse([], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return new DataResponse([], Http::STATUS_BAD_REQUEST);
|
||||
|
|
|
|||
Loading…
Reference in a new issue