X Tutup
Skip to content

Commit 91e59ba

Browse files
David Christofasphil-davis
authored andcommitted
fix: implement missing getSize method in SharedFile.php
The webdav-api for public files couldn't get the correct file size since `SharedFile.php` did not implement the `getSize` method. Fixes #36741
1 parent 9f1bb6c commit 91e59ba

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

apps/dav/lib/Files/PublicFiles/SharedFile.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,8 @@ public function put($data) {
7171
throw new Forbidden('Permission denied to change data');
7272
}
7373
}
74+
75+
public function getSize() {
76+
return $this->file->getSize();
77+
}
7478
}

apps/dav/tests/unit/Files/PublicFiles/PublicFileTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ public function testETag() {
3434
$metaFile = new SharedFile($file, $share);
3535
$this->assertEquals('"123456"', $metaFile->getETag());
3636
}
37+
38+
public function testSize() {
39+
$file = $this->createMock(File::class);
40+
$file->method('getSize')->willReturn(42);
41+
$share = $this->createMock(IShare::class);
42+
$metaFile = new SharedFile($file, $share);
43+
$this->assertEquals(42, $metaFile->getSize());
44+
}
3745
}

changelog/unreleased/36778

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Bugfix: Return correct file size in the public files webdav API
2+
3+
https://github.com/owncloud/core/issues/36741
4+
https://github.com/owncloud/core/pull/36778

0 commit comments

Comments
 (0)
X Tutup