aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2024-10-24 17:47:07 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-10-25 10:26:16 +0000
commit26678174cc4531b0616344cdd7e1411d447b2709 (patch)
treefdab82bdf64f6b3c087b214e30c18d2c0b1d94c5
parente46f180d267d00ac17f20dd03c6492df33b7522b (diff)
downloadnextcloud-server-backport/48882/stable30.tar.gz
nextcloud-server-backport/48882/stable30.zip
refactor(ShareApiController): Check for null and empty strings with empty()backport/48882/stable30
Proactive measure to avoid warnings in higher php versions as well possible type errors Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 0d825deea9e..dfbcc31ba81 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -660,13 +660,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');
}