Skip to content

Commit 600202f

Browse files
fix(carddav): limit vcard size
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
1 parent bc4e9e9 commit 600202f

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

apps/dav/lib/CardDAV/Validation/CardDavValidatePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function initialize(Server $server): void {
2929

3030
public function beforePut(RequestInterface $request, ResponseInterface $response): bool {
3131
// evaluate if card size exceeds defined limit
32-
$cardSizeLimit = $this->config->getValueInt(Application::APP_ID, 'card_size_limit', 5242880);
32+
$cardSizeLimit = (int) $this->config->getValue(Application::APP_ID, 'card_size_limit', '5242880');
3333
if ((int) $request->getRawServerValue('CONTENT_LENGTH') > $cardSizeLimit) {
3434
throw new Forbidden("VCard object exceeds $cardSizeLimit bytes");
3535
}

apps/dav/tests/unit/CardDAV/Validation/CardDavValidatePluginTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public function testPutSizeLessThenLimit(): void {
3939

4040
// construct method responses
4141
$this->config
42-
->method('getValueInt')
43-
->with('dav', 'card_size_limit', 5242880)
44-
->willReturn(5242880);
42+
->method('getValue')
43+
->with('dav', 'card_size_limit', '5242880')
44+
->willReturn('5242880');
4545
$this->request
4646
->method('getRawServerValue')
4747
->with('CONTENT_LENGTH')
@@ -57,9 +57,9 @@ public function testPutSizeMoreThenLimit(): void {
5757

5858
// construct method responses
5959
$this->config
60-
->method('getValueInt')
61-
->with('dav', 'card_size_limit', 5242880)
62-
->willReturn(5242880);
60+
->method('getValue')
61+
->with('dav', 'card_size_limit', '5242880')
62+
->willReturn('5242880');
6363
$this->request
6464
->method('getRawServerValue')
6565
->with('CONTENT_LENGTH')

0 commit comments

Comments
 (0)