Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable31] fix: Ensure label is always a string #50449

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/files_sharing/lib/Controller/ShareAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,10 @@ public function createShare(
}

// If we have a label, use it
if (!empty($label)) {
if ($label !== '') {
if (strlen($label) > 255) {
throw new OCSBadRequestException('Maximum label length is 255');
}
$share->setLabel($label);
}

Expand Down
2 changes: 1 addition & 1 deletion apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ protected function createShareObject(array $data): IShare {
$share->setPassword($data['password']);
$passwordExpirationTime = \DateTime::createFromFormat('Y-m-d H:i:s', $data['password_expiration_time'] ?? '');
$share->setPasswordExpirationTime($passwordExpirationTime !== false ? $passwordExpirationTime : null);
$share->setLabel($data['label']);
$share->setLabel($data['label'] ?? '');
$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
$share->setHideDownload((bool)$data['hide_download']);
$share->setReminderSent((bool)$data['reminder_sent']);
Expand Down
3 changes: 1 addition & 2 deletions lib/private/Share20/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,13 @@ class Share implements IShare {
private $shareTime;
/** @var bool */
private $mailSend;
/** @var string */
private $label = '';
/** @var ICacheEntry|null */
private $nodeCacheEntry;
/** @var bool */
private $hideDownload = false;
private bool $reminderSent = false;

private string $label = '';
private bool $noExpirationDate = false;

public function __construct(
Expand Down
Loading