@@ -396,7 +396,12 @@ protected function validateExpirationDateInternal(\OCP\Share\IShare $share) {
396396 if ($ fullId === null && $ expirationDate === null && $ this ->shareApiInternalDefaultExpireDate ()) {
397397 $ expirationDate = new \DateTime ();
398398 $ expirationDate ->setTime (0 ,0 ,0 );
399- $ expirationDate ->add (new \DateInterval ('P ' .$ this ->shareApiInternalDefaultExpireDays ().'D ' ));
399+
400+ $ days = (int )$ this ->config ->getAppValue ('core ' , 'internal_defaultExpDays ' , $ this ->shareApiLinkDefaultExpireDays ());
401+ if ($ days > $ this ->shareApiLinkDefaultExpireDays ()) {
402+ $ days = $ this ->shareApiLinkDefaultExpireDays ();
403+ }
404+ $ expirationDate ->add (new \DateInterval ('P ' .$ days .'D ' ));
400405 }
401406
402407 // If we enforce the expiration date check that is does not exceed
@@ -467,7 +472,12 @@ protected function validateExpirationDate(\OCP\Share\IShare $share) {
467472 if ($ fullId === null && $ expirationDate === null && $ this ->shareApiLinkDefaultExpireDate ()) {
468473 $ expirationDate = new \DateTime ();
469474 $ expirationDate ->setTime (0 ,0 ,0 );
470- $ expirationDate ->add (new \DateInterval ('P ' .$ this ->shareApiLinkDefaultExpireDays ().'D ' ));
475+
476+ $ days = (int )$ this ->config ->getAppValue ('core ' , 'link_defaultExpDays ' , $ this ->shareApiLinkDefaultExpireDays ());
477+ if ($ days > $ this ->shareApiLinkDefaultExpireDays ()) {
478+ $ days = $ this ->shareApiLinkDefaultExpireDays ();
479+ }
480+ $ expirationDate ->add (new \DateInterval ('P ' .$ days .'D ' ));
471481 }
472482
473483 // If we enforce the expiration date check that is does not exceed
0 commit comments