aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-19 17:10:13 +0200
committerGitHub <noreply@github.com>2024-09-19 17:10:13 +0200
commit10da080435339f1883afba7ad69146e2829009d8 (patch)
tree8695a9d9aeb4b040451a20a5617c2cecdd42da6d /apps
parentafd88e079843467bbbc1366045f6c5b23ed93026 (diff)
parent767af5485e4b3a5bafae2b060ced3cfe2392a6ba (diff)
downloadnextcloud-server-10da080435339f1883afba7ad69146e2829009d8.tar.gz
nextcloud-server-10da080435339f1883afba7ad69146e2829009d8.zip
Merge pull request #48205 from nextcloud/ci-fix-30
[stable30] Ci fixes
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/Server.php23
-rw-r--r--apps/dav/lib/Files/ErrorPagePlugin.php1
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php3
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php42
-rw-r--r--apps/files_sharing/tests/Controller/ShareControllerTest.php3
-rw-r--r--apps/files_sharing/tests/External/CacheTest.php2
-rw-r--r--apps/files_trashbin/tests/StorageTest.php1
7 files changed, 71 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Server.php b/apps/dav/lib/Connector/Sabre/Server.php
index b7ca8a0a1c0..610c79d5661 100644
--- a/apps/dav/lib/Connector/Sabre/Server.php
+++ b/apps/dav/lib/Connector/Sabre/Server.php
@@ -25,4 +25,27 @@ class Server extends \Sabre\DAV\Server {
self::$exposeVersion = false;
$this->enablePropfindDepthInfinity = true;
}
+
+ // Copied from 3rdparty/sabre/dav/lib/DAV/Server.php
+ // Should be them exact same without the exception output.
+ public function start(): void {
+ try {
+ // If nginx (pre-1.2) is used as a proxy server, and SabreDAV as an
+ // origin, we must make sure we send back HTTP/1.0 if this was
+ // requested.
+ // This is mainly because nginx doesn't support Chunked Transfer
+ // Encoding, and this forces the webserver SabreDAV is running on,
+ // to buffer entire responses to calculate Content-Length.
+ $this->httpResponse->setHTTPVersion($this->httpRequest->getHTTPVersion());
+
+ // Setting the base url
+ $this->httpRequest->setBaseUrl($this->getBaseUri());
+ $this->invokeMethod($this->httpRequest, $this->httpResponse);
+ } catch (\Throwable $e) {
+ try {
+ $this->emit('exception', [$e]);
+ } catch (\Exception $ignore) {
+ }
+ }
+ }
}
diff --git a/apps/dav/lib/Files/ErrorPagePlugin.php b/apps/dav/lib/Files/ErrorPagePlugin.php
index ddf04d0f763..2b93f0e7a49 100644
--- a/apps/dav/lib/Files/ErrorPagePlugin.php
+++ b/apps/dav/lib/Files/ErrorPagePlugin.php
@@ -92,7 +92,6 @@ class ErrorPagePlugin extends ServerPlugin {
*/
public function sendResponse() {
$this->server->sapi->sendResponse($this->server->httpResponse);
- exit();
}
private function acceptHtml(): bool {
diff --git a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
index 200008bcfce..11a44f26942 100644
--- a/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/RequestTest/PartFileInRootUploadTest.php
@@ -7,6 +7,7 @@
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre\RequestTest;
+use OC\AllConfig;
use OCP\IConfig;
/**
@@ -31,7 +32,7 @@ class PartFileInRootUploadTest extends UploadTest {
return $config->getSystemValue($key, $default);
}
});
- $this->overwriteService('AllConfig', $mockConfig);
+ $this->overwriteService(AllConfig::class, $mockConfig);
parent::setUp();
}
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 85dfb9145cf..de820583d48 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -534,6 +534,8 @@ class ShareAPIControllerTest extends TestCase {
$parentFolder = $this->getMockBuilder(Folder::class)->getMock();
$parentFolder->method('getId')->willReturn(3);
+ $mountPoint = $this->createMock(IMountPoint::class);
+ $mountPoint->method('getMountType')->willReturn('');
$file = $this->getMockBuilder('OCP\Files\File')->getMock();
$file->method('getId')->willReturn(1);
@@ -543,6 +545,7 @@ class ShareAPIControllerTest extends TestCase {
$file->method('getSize')->willReturn(123465);
$file->method('getMTime')->willReturn(1234567890);
$file->method('getMimeType')->willReturn('myMimeType');
+ $file->method('getMountPoint')->willReturn($mountPoint);
$folder = $this->getMockBuilder(Folder::class)->getMock();
$folder->method('getId')->willReturn(2);
@@ -552,6 +555,7 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getSize')->willReturn(123465);
$folder->method('getMTime')->willReturn(1234567890);
$folder->method('getMimeType')->willReturn('myFolderMimeType');
+ $folder->method('getMountPoint')->willReturn($mountPoint);
[$shareAttributes, $shareAttributesReturnJson] = $this->mockShareAttributes();
@@ -607,6 +611,9 @@ class ShareAPIControllerTest extends TestCase {
'item_size' => 123465,
'item_mtime' => 1234567890,
'attributes' => null,
+ 'item_permissions' => 4,
+ 'is-mount-root' => false,
+ 'mount-type' => '',
];
$data[] = [$share, $expected];
@@ -661,6 +668,9 @@ class ShareAPIControllerTest extends TestCase {
'item_size' => 123465,
'item_mtime' => 1234567890,
'attributes' => null,
+ 'item_permissions' => 4,
+ 'is-mount-root' => false,
+ 'mount-type' => '',
];
$data[] = [$share, $expected];
@@ -721,6 +731,9 @@ class ShareAPIControllerTest extends TestCase {
'item_size' => 123465,
'item_mtime' => 1234567890,
'attributes' => null,
+ 'item_permissions' => 4,
+ 'is-mount-root' => false,
+ 'mount-type' => '',
];
$data[] = [$share, $expected];
@@ -3740,6 +3753,12 @@ class ShareAPIControllerTest extends TestCase {
$folder->method('getMimeType')->willReturn('myFolderMimeType');
$fileWithPreview->method('getMimeType')->willReturn('mimeWithPreview');
+ $mountPoint = $this->createMock(IMountPoint::class);
+ $mountPoint->method('getMountType')->willReturn('');
+ $file->method('getMountPoint')->willReturn($mountPoint);
+ $folder->method('getMountPoint')->willReturn($mountPoint);
+ $fileWithPreview->method('getMountPoint')->willReturn($mountPoint);
+
$file->method('getPath')->willReturn('file');
$folder->method('getPath')->willReturn('folder');
$fileWithPreview->method('getPath')->willReturn('fileWithPreview');
@@ -3839,6 +3858,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => '[{"scope":"permissions","key":"download","value":true}]',
+ 'item_permissions' => 1,
], $share, [], false
];
// User backend up
@@ -3880,6 +3900,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => '[{"scope":"permissions","key":"download","value":true}]',
+ 'item_permissions' => 1,
], $share, [
['owner', $owner],
['initiator', $initiator],
@@ -3937,6 +3958,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -3990,6 +4012,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 11,
], $share, [], false
];
@@ -4044,6 +4067,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4095,6 +4119,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4153,6 +4178,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4211,6 +4237,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4263,6 +4290,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4315,6 +4343,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4370,6 +4399,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4422,6 +4452,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4474,6 +4505,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4543,6 +4575,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4598,6 +4631,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, [], false
];
@@ -4651,6 +4685,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 11,
], $share, [], false
];
@@ -4815,6 +4850,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 1,
], $share, false, []
];
@@ -4866,6 +4902,7 @@ class ShareAPIControllerTest extends TestCase {
'is-mount-root' => false,
'mount-type' => '',
'attributes' => null,
+ 'item_permissions' => 9,
], $share, true, [
'share_with_displayname' => 'recipientRoomName'
]
@@ -4905,11 +4942,14 @@ class ShareAPIControllerTest extends TestCase {
->willReturn(true);
$helper = $this->getMockBuilder('\OCA\Talk\Share\Helper\ShareAPIController')
- ->setMethods(['formatShare'])
+ ->setMethods(['formatShare', 'canAccessShare'])
->getMock();
$helper->method('formatShare')
->with($share)
->willReturn($formatShareByHelper);
+ $helper->method('canAccessShare')
+ ->with($share)
+ ->willReturn(true);
$this->serverContainer->method('get')
->with('\OCA\Talk\Share\Helper\ShareAPIController')
diff --git a/apps/files_sharing/tests/Controller/ShareControllerTest.php b/apps/files_sharing/tests/Controller/ShareControllerTest.php
index 79b90d8a156..d2e6471eafa 100644
--- a/apps/files_sharing/tests/Controller/ShareControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareControllerTest.php
@@ -353,7 +353,8 @@ class ShareControllerTest extends \Test\TestCase {
'note' => $note,
'hideDownload' => false,
'showgridview' => false,
- 'label' => ''
+ 'label' => '',
+ 'filename' => $filename,
];
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
diff --git a/apps/files_sharing/tests/External/CacheTest.php b/apps/files_sharing/tests/External/CacheTest.php
index fa613b6de98..6f076cb475b 100644
--- a/apps/files_sharing/tests/External/CacheTest.php
+++ b/apps/files_sharing/tests/External/CacheTest.php
@@ -11,6 +11,7 @@ use OCA\Files_Sharing\Tests\TestCase;
use OCP\Contacts\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudIdManager;
+use OCP\Files\Cache\ICacheEntry;
use OCP\ICacheFactory;
use OCP\IURLGenerator;
use OCP\IUserManager;
@@ -74,6 +75,7 @@ class CacheTest extends TestCase {
$this->storage,
$this->cloudIdManager->getCloudId($this->remoteUser, 'http://example.com/owncloud')
);
+ $this->cache->insert('', ['size' => 0, 'mtime' => 0, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]);
$this->cache->put(
'test.txt',
[
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index 18fe59f7f7d..70a40d10d3f 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -591,6 +591,7 @@ class StorageTest extends \Test\TestCase {
$event->expects($this->any())->method('shouldMoveToTrashBin')->willReturn(!$appDisablesTrash);
$userFolder->expects($this->any())->method('getById')->with($fileID)->willReturn([$node]);
+ $rootFolder->expects($this->any())->method('getById')->with($fileID)->willReturn([$node]);
$rootFolder->expects($this->any())->method('getUserFolder')->willReturn($userFolder);
$storage = $this->getMockBuilder(Storage::class)