nextcloud/server · error · OCP\AppFramework\OCS\OCSBadRequestException
Expiration time should be greater than 0 and less than or eq
Error message
Expiration time should be greater than 0 and less than or equal to 86400
What it means
Error "Expiration time should be greater than 0 and less than or equal to 86400" thrown in nextcloud/server.
Source
Thrown at apps/dav/lib/Controller/DirectController.php:75
*
* 200: Direct link returned
*/
#[NoAdminRequired]
public function getUrl(int $fileId, int $expirationTime = 60 * 60 * 8): DataResponse {
if (!$this->shareManager->shareApiAllowLinks()) {
throw new OCSForbiddenException('Creating direct links is disabled');
}
$userFolder = $this->rootFolder->getUserFolder($this->userId);
$file = $userFolder->getFirstNodeById($fileId);
if (!$file) {
throw new OCSNotFoundException();
}
if ($expirationTime <= 0 || $expirationTime > (60 * 60 * 24)) {
throw new OCSBadRequestException('Expiration time should be greater than 0 and less than or equal to ' . (60 * 60 * 24));
}
if (!($file instanceof File)) {
throw new OCSBadRequestException('Direct download only works for files');
}
$event = new BeforeDirectFileDownloadEvent($userFolder->getRelativePath($file->getPath()));
$this->eventDispatcher->dispatchTyped($event);
if ($event->isSuccessful() === false) {
throw new OCSForbiddenException('Permission denied to download file');
}
//TODO: at some point we should use the directdownlaod function of storages
$direct = new Direct();
$direct->setUserId($this->userId);
$direct->setFileId($fileId);
View on GitHub (pinned to ecdeb153ff)
When it happens
Trigger: Thrown at apps/dav/lib/Controller/DirectController.php:75 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/8a93bfb0c5213366.
Report an issue: GitHub.