Skip to content

Commit 18e720d

Browse files
committed
allow to update lables for public link shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
1 parent 818ca4d commit 18e720d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

apps/files_sharing/lib/Controller/ShareAPIController.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ public function getShares(
744744
* @param string $publicUpload
745745
* @param string $expireDate
746746
* @param string $note
747+
* @param string $label
747748
* @return DataResponse
748749
* @throws LockedException
749750
* @throws NotFoundException
@@ -758,7 +759,8 @@ public function updateShare(
758759
string $sendPasswordByTalk = null,
759760
string $publicUpload = null,
760761
string $expireDate = null,
761-
string $note = null
762+
string $note = null,
763+
string $label = null
762764
): DataResponse {
763765
try {
764766
$share = $this->getShareById($id);
@@ -772,7 +774,14 @@ public function updateShare(
772774
throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
773775
}
774776

775-
if ($permissions === null && $password === null && $sendPasswordByTalk === null && $publicUpload === null && $expireDate === null && $note === null) {
777+
if ($permissions === null &&
778+
$password === null &&
779+
$sendPasswordByTalk === null &&
780+
$publicUpload === null &&
781+
$expireDate === null &&
782+
$note === null &&
783+
$label === null
784+
) {
776785
throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));
777786
}
778787

@@ -849,6 +858,10 @@ public function updateShare(
849858
$share->setPassword($password);
850859
}
851860

861+
if ($label !== null) {
862+
$share->setLabel($label);
863+
}
864+
852865
} else {
853866
if ($permissions !== null) {
854867
$permissions = (int)$permissions;

lib/private/Share20/DefaultShareProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ public function update(\OCP\Share\IShare $share) {
301301
->set('token', $qb->createNamedParameter($share->getToken()))
302302
->set('expiration', $qb->createNamedParameter($share->getExpirationDate(), IQueryBuilder::PARAM_DATE))
303303
->set('note', $qb->createNamedParameter($share->getNote()))
304+
->set('label', $qb->createNamedParameter($share->getLabel()))
304305
->execute();
305306
}
306307

0 commit comments

Comments
 (0)