mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 10:10:49 -04:00
Merge pull request #48882 from nextcloud/safety-net-null-check
refactor(ShareApiController): Check for null and empty strings with e…
This commit is contained in:
commit
ccd14f3a65
1 changed files with 4 additions and 7 deletions
|
|
@ -661,13 +661,10 @@ class ShareAPIController extends OCSController {
|
|||
// Handle mail send
|
||||
if (is_null($sendMail)) {
|
||||
// Define a default behavior when sendMail is not provided
|
||||
if ($shareType === IShare::TYPE_EMAIL && strlen($shareWith) !== 0) {
|
||||
// For email shares, the default is to send the mail
|
||||
$share->setMailSend(true);
|
||||
} else {
|
||||
// For all other share types, the default is to not send the mail
|
||||
$share->setMailSend(false);
|
||||
}
|
||||
// For email shares with a valid recipient, the default is to send the mail
|
||||
// For all other share types, the default is to not send the mail
|
||||
$allowSendMail = ($shareType === IShare::TYPE_EMAIL && $shareWith !== null && $shareWith !== '');
|
||||
$share->setMailSend($allowSendMail);
|
||||
} else {
|
||||
$share->setMailSend($sendMail === 'true');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue