Skip to content

Commit f3918da

Browse files
authored
Merge branch 'stable33' into release/33.0.1_rc1
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2 parents 5492b38 + 852a860 commit f3918da

50 files changed

Lines changed: 497 additions & 174 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function (\Sabre\DAV\Server $server) use (
9292
}
9393

9494
$share = $authBackend->getShare();
95-
$owner = $share->getShareOwner();
9695
$isReadable = $share->getPermissions() & Constants::PERMISSION_READ;
9796
$fileId = $share->getNodeId();
9897

@@ -107,7 +106,7 @@ function (\Sabre\DAV\Server $server) use (
107106
Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
108107

109108
$rootFolder = Server::get(IRootFolder::class);
110-
$userFolder = $rootFolder->getUserFolder($owner);
109+
$userFolder = $rootFolder->getUserFolder($share->getSharedBy());
111110
$node = $userFolder->getFirstNodeById($fileId);
112111
if (!$node) {
113112
throw new \Sabre\DAV\Exception\NotFound();

apps/dav/appinfo/v2/publicremote.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
}
100100

101101
$share = $authBackend->getShare();
102-
$owner = $share->getShareOwner();
103102
$isReadable = $share->getPermissions() & Constants::PERMISSION_READ;
104103
$fileId = $share->getNodeId();
105104

@@ -135,7 +134,7 @@
135134
Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
136135

137136
$rootFolder = Server::get(IRootFolder::class);
138-
$userFolder = $rootFolder->getUserFolder($owner);
137+
$userFolder = $rootFolder->getUserFolder($share->getSharedBy());
139138
$node = $userFolder->getFirstNodeById($fileId);
140139
if (!$node) {
141140
throw new NotFound();

apps/dav/l10n/hr.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ OC.L10N.register(
236236
"Failed to check file size: %1$s" : "Neuspjela provjera veličine datoteke: %1$s",
237237
"Could not open file: %1$s (%2$d), file does seem to exist" : "Nije moguće otvoriti datoteku: %1$s (%2$d), čini se da datoteka postoji",
238238
"Could not open file: %1$s (%2$d), file doesn't seem to exist" : "Nije moguće otvoriti datoteku: %1$s (%2$d), čini se da datoteka ne postoji",
239+
"Failed to get size for : %1$s" : "Neuspjelo dohvaćanje veličine: %1$s",
239240
"Encryption not ready: %1$s" : "Šifriranje nije spremno: %1$s",
240241
"Failed to open file: %1$s" : "Neuspjelo otvaranje datoteke: %1$s",
241242
"Failed to unlink: %1$s" : "Neuspjelo uklanjanje veze: %1$s",
@@ -252,6 +253,7 @@ OC.L10N.register(
252253
"Completed on %s" : "Završeno na %s",
253254
"Due on %s by %s" : "%s treba završiti do %s",
254255
"Due on %s" : "Treba završiti do %s",
256+
"This is an example contact" : "Ovo je primjer kontakta",
255257
"Welcome to Nextcloud Calendar!\n\nThis is a sample event - explore the flexibility of planning with Nextcloud Calendar by making any edits you want!\n\nWith Nextcloud Calendar, you can:\n- Create, edit, and manage events effortlessly.\n- Create multiple calendars and share them with teammates, friends, or family.\n- Check availability and display your busy times to others.\n- Seamlessly integrate with apps and devices via CalDAV.\n- Customize your experience: schedule recurring events, adjust notifications and other settings." : "Dobrodošli u Nextcloud Kalendar!\n\nOvo je primjer događaja – istražite fleksibilnost planiranja s Nextcloud Kalendarom tako da napravite bilo kakve izmjene koje želite!\n\nUz Nextcloud Kalendar možete:\n- Jednostavno stvarati, uređivati i upravljati događajima..\n- Stvarati više kalendara i dijeliti ih s kolegama, prijateljima ili obitelji.\n- Provjeravati dostupnost i drugima prikazivati svoja zauzeta razdoblja.\n- Neprimjetno se integrirati s aplikacijama i uređajima putem CalDAV-a.\n- Prilagoditi svoje iskustvo: zakazivati ponavljajuće događaje, prilagođavati obavijesti i druge postavke.",
256258
"Example event - open me!" : "Primjer događaja – otvori me!",
257259
"System Address Book" : "Adresar sustava",

apps/dav/l10n/hr.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
"Failed to check file size: %1$s" : "Neuspjela provjera veličine datoteke: %1$s",
235235
"Could not open file: %1$s (%2$d), file does seem to exist" : "Nije moguće otvoriti datoteku: %1$s (%2$d), čini se da datoteka postoji",
236236
"Could not open file: %1$s (%2$d), file doesn't seem to exist" : "Nije moguće otvoriti datoteku: %1$s (%2$d), čini se da datoteka ne postoji",
237+
"Failed to get size for : %1$s" : "Neuspjelo dohvaćanje veličine: %1$s",
237238
"Encryption not ready: %1$s" : "Šifriranje nije spremno: %1$s",
238239
"Failed to open file: %1$s" : "Neuspjelo otvaranje datoteke: %1$s",
239240
"Failed to unlink: %1$s" : "Neuspjelo uklanjanje veze: %1$s",
@@ -250,6 +251,7 @@
250251
"Completed on %s" : "Završeno na %s",
251252
"Due on %s by %s" : "%s treba završiti do %s",
252253
"Due on %s" : "Treba završiti do %s",
254+
"This is an example contact" : "Ovo je primjer kontakta",
253255
"Welcome to Nextcloud Calendar!\n\nThis is a sample event - explore the flexibility of planning with Nextcloud Calendar by making any edits you want!\n\nWith Nextcloud Calendar, you can:\n- Create, edit, and manage events effortlessly.\n- Create multiple calendars and share them with teammates, friends, or family.\n- Check availability and display your busy times to others.\n- Seamlessly integrate with apps and devices via CalDAV.\n- Customize your experience: schedule recurring events, adjust notifications and other settings." : "Dobrodošli u Nextcloud Kalendar!\n\nOvo je primjer događaja – istražite fleksibilnost planiranja s Nextcloud Kalendarom tako da napravite bilo kakve izmjene koje želite!\n\nUz Nextcloud Kalendar možete:\n- Jednostavno stvarati, uređivati i upravljati događajima..\n- Stvarati više kalendara i dijeliti ih s kolegama, prijateljima ili obitelji.\n- Provjeravati dostupnost i drugima prikazivati svoja zauzeta razdoblja.\n- Neprimjetno se integrirati s aplikacijama i uređajima putem CalDAV-a.\n- Prilagoditi svoje iskustvo: zakazivati ponavljajuće događaje, prilagođavati obavijesti i druge postavke.",
254256
"Example event - open me!" : "Primjer događaja – otvori me!",
255257
"System Address Book" : "Adresar sustava",

apps/dav/l10n/zh_CN.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ OC.L10N.register(
236236
"Failed to check file size: %1$s" : "检查文件大小失败:%1$s",
237237
"Could not open file: %1$s (%2$d), file does seem to exist" : "无法打开文件:%1$s(%2$d),文件似乎不存在",
238238
"Could not open file: %1$s (%2$d), file doesn't seem to exist" : "无法打开文件:%1$s(%2$d),文件似乎不存在",
239+
"Failed to get size for : %1$s" : "无法获取以下项目的大小:%1$s",
239240
"Encryption not ready: %1$s" : "加密不可用:%1$s",
240241
"Failed to open file: %1$s" : "打开文件失败:%1$s",
241242
"Failed to unlink: %1$s" : "解除链接失败:%1$s",
@@ -252,6 +253,7 @@ OC.L10N.register(
252253
"Completed on %s" : "已完成 %s",
253254
"Due on %s by %s" : "到期于 %s,在 %s 之前",
254255
"Due on %s" : "到期于 %s",
256+
"This is an example contact" : "这是一个示例联系人",
255257
"Welcome to Nextcloud Calendar!\n\nThis is a sample event - explore the flexibility of planning with Nextcloud Calendar by making any edits you want!\n\nWith Nextcloud Calendar, you can:\n- Create, edit, and manage events effortlessly.\n- Create multiple calendars and share them with teammates, friends, or family.\n- Check availability and display your busy times to others.\n- Seamlessly integrate with apps and devices via CalDAV.\n- Customize your experience: schedule recurring events, adjust notifications and other settings." : "欢迎使用 Nextcloud 日历!\n\n这是一个示例事件——探索使用 Nextcloud 日历进行规划的灵活性,进行任何您想要的编辑!\n\n使用 Nextcloud 日历,您可以:\n- 轻松创建、编辑和管理事件。\n- 创建多个日历并与队友、朋友或家人共享。\n- 查看空闲时间并向他人显示您的忙碌时间。\n- 通过 CalDAV 与应用和设备无缝集成。\n- 自定义您的体验:安排重复事件、调整通知和其他设置。",
256258
"Example event - open me!" : "示例事件——打开我!",
257259
"System Address Book" : "系统通讯录",

apps/dav/l10n/zh_CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
"Failed to check file size: %1$s" : "检查文件大小失败:%1$s",
235235
"Could not open file: %1$s (%2$d), file does seem to exist" : "无法打开文件:%1$s(%2$d),文件似乎不存在",
236236
"Could not open file: %1$s (%2$d), file doesn't seem to exist" : "无法打开文件:%1$s(%2$d),文件似乎不存在",
237+
"Failed to get size for : %1$s" : "无法获取以下项目的大小:%1$s",
237238
"Encryption not ready: %1$s" : "加密不可用:%1$s",
238239
"Failed to open file: %1$s" : "打开文件失败:%1$s",
239240
"Failed to unlink: %1$s" : "解除链接失败:%1$s",
@@ -250,6 +251,7 @@
250251
"Completed on %s" : "已完成 %s",
251252
"Due on %s by %s" : "到期于 %s,在 %s 之前",
252253
"Due on %s" : "到期于 %s",
254+
"This is an example contact" : "这是一个示例联系人",
253255
"Welcome to Nextcloud Calendar!\n\nThis is a sample event - explore the flexibility of planning with Nextcloud Calendar by making any edits you want!\n\nWith Nextcloud Calendar, you can:\n- Create, edit, and manage events effortlessly.\n- Create multiple calendars and share them with teammates, friends, or family.\n- Check availability and display your busy times to others.\n- Seamlessly integrate with apps and devices via CalDAV.\n- Customize your experience: schedule recurring events, adjust notifications and other settings." : "欢迎使用 Nextcloud 日历!\n\n这是一个示例事件——探索使用 Nextcloud 日历进行规划的灵活性,进行任何您想要的编辑!\n\n使用 Nextcloud 日历,您可以:\n- 轻松创建、编辑和管理事件。\n- 创建多个日历并与队友、朋友或家人共享。\n- 查看空闲时间并向他人显示您的忙碌时间。\n- 通过 CalDAV 与应用和设备无缝集成。\n- 自定义您的体验:安排重复事件、调整通知和其他设置。",
254256
"Example event - open me!" : "示例事件——打开我!",
255257
"System Address Book" : "系统通讯录",

apps/dav/lib/CalDAV/CalendarImpl.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use OCP\Calendar\Exceptions\CalendarException;
1717
use OCP\Calendar\ICalendarExport;
1818
use OCP\Calendar\ICalendarIsEnabled;
19+
use OCP\Calendar\ICalendarIsPublic;
1920
use OCP\Calendar\ICalendarIsShared;
2021
use OCP\Calendar\ICalendarIsWritable;
2122
use OCP\Calendar\ICreateFromString;
@@ -32,7 +33,7 @@
3233

3334
use function Sabre\Uri\split as uriSplit;
3435

35-
class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIsWritable, ICalendarIsShared, ICalendarExport, ICalendarIsEnabled {
36+
class CalendarImpl implements ICreateFromString, IHandleImipMessage, ICalendarIsWritable, ICalendarIsShared, ICalendarExport, ICalendarIsEnabled, ICalendarIsPublic {
3637
public function __construct(
3738
private Calendar $calendar,
3839
/** @var array<string, mixed> */
@@ -168,6 +169,13 @@ public function isShared(): bool {
168169
return $this->calendar->isShared();
169170
}
170171

172+
/**
173+
* @since 33.0.1, 32.0.7, 31.0.14.1, 30.0.17.8
174+
*/
175+
public function getPublicToken(): ?string {
176+
return $this->calendar->getPublishStatus() ?: null;
177+
}
178+
171179
/**
172180
* @throws CalendarException
173181
*/
@@ -336,5 +344,4 @@ public function export(?CalendarExportOptions $options = null): Generator {
336344
}
337345
}
338346
}
339-
340347
}

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,11 +474,15 @@ public function get() {
474474
}
475475
}
476476

477+
$logger = Server::get(LoggerInterface::class);
477478
// comparing current file size with the one in DB
478479
// if different, fix DB and refresh cache.
480+
//
479481
$fsSize = $this->fileView->filesize($this->getPath());
480-
if ($this->getSize() !== $fsSize) {
481-
$logger = Server::get(LoggerInterface::class);
482+
if ($fsSize === false) {
483+
$logger->warning('file not found on storage after successfully opening it');
484+
throw new ServiceUnavailable($this->l10n->t('Failed to get size for : %1$s', [$this->getPath()]));
485+
} elseif ($this->getSize() !== $fsSize) {
482486
$logger->warning('fixing cached size of file id=' . $this->getId() . ', cached size was ' . $this->getSize() . ', but the filesystem reported a size of ' . $fsSize);
483487

484488
$this->getFileInfo()->getStorage()->getUpdater()->update($this->getFileInfo()->getInternalPath());

apps/dav/lib/Files/Sharing/PublicLinkCheckPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function initialize(\Sabre\DAV\Server $server) {
4141
}
4242

4343
public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
44-
// verify that the owner didn't have their share permissions revoked
44+
// verify that the initiator didn't have their share permissions revoked
4545
if ($this->fileInfo && !$this->fileInfo->isShareable()) {
4646
throw new NotFound();
4747
}

apps/dav/tests/unit/CalDAV/CalendarImplTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp(): void {
3333
$this->backend = $this->createMock(CalDavBackend::class);
3434
$this->calendar = $this->createMock(Calendar::class);
3535
$this->calendarInfo = [
36-
'id' => 'fancy_id_123',
36+
'id' => 123,
3737
'{DAV:}displayname' => 'user readable name 123',
3838
'{http://apple.com/ns/ical/}calendar-color' => '#AABBCC',
3939
'uri' => '/this/is/a/uri',
@@ -62,7 +62,7 @@ protected function setUp(): void {
6262

6363

6464
public function testGetKey(): void {
65-
$this->assertEquals($this->calendarImpl->getKey(), 'fancy_id_123');
65+
$this->assertEquals($this->calendarImpl->getKey(), '123');
6666
}
6767

6868
public function testGetDisplayname(): void {
@@ -73,6 +73,18 @@ public function testGetDisplayColor(): void {
7373
$this->assertEquals($this->calendarImpl->getDisplayColor(), '#AABBCC');
7474
}
7575

76+
public function testGetPublicToken(): void {
77+
$publicToken = $this->calendar->setPublishStatus(true);
78+
79+
$this->assertEquals($this->calendarImpl->getPublicToken(), $publicToken);
80+
}
81+
82+
public function testGetPublicTokenWithPrivateCalendar(): void {
83+
$this->calendar->setPublishStatus(false);
84+
85+
$this->assertNull($this->calendarImpl->getPublicToken());
86+
}
87+
7688
public function testSearch(): void {
7789
$this->backend->expects($this->once())
7890
->method('search')
@@ -266,5 +278,4 @@ public function getHrefs(): array {
266278

267279
$calendarImpl->handleIMipMessage('fakeUser', $vObject->serialize());
268280
}
269-
270281
}

0 commit comments

Comments
 (0)