From 4f42933fc5b434a93214565e878e334c841de6ea Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 24 Jun 2026 22:48:33 +0200 Subject: [PATCH] chore: migrate away from deprecated OC_App Signed-off-by: Ferdinand Thiessen --- lib/AppWhitelist.php | 2 +- tests/unit/AppWhitelistTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/AppWhitelist.php b/lib/AppWhitelist.php index 7fc2f9a4..0e873ce4 100644 --- a/lib/AppWhitelist.php +++ b/lib/AppWhitelist.php @@ -102,7 +102,7 @@ private function getRequestedApp(string|false $url): string { if (str_starts_with($url, '/apps/')) { // empty string / 'apps' / $app / rest of the route [, , $app,] = explode('/', $url, 4); - return \OC_App::cleanAppId($app); + return $this->appManager->cleanAppId($app); } if ($url === '/cron.php') { diff --git a/tests/unit/AppWhitelistTest.php b/tests/unit/AppWhitelistTest.php index 378fec80..025fa4cf 100644 --- a/tests/unit/AppWhitelistTest.php +++ b/tests/unit/AppWhitelistTest.php @@ -60,6 +60,8 @@ public function testIsUrlAllowed(): void { ->willReturn(true); $this->guestManager->method('isGuest') ->willReturn(true); + $this->appManager->method('cleanAppId') + ->willReturnCallback(fn (string $appId) => $appId); $user = $this->createStub(IUser::class); $this->assertFalse($this->appWhitelist->isUrlAllowed($user, '/apps/news/...')); @@ -73,6 +75,8 @@ public function testIsUrlAllowedNoWhitelist(): void { ->willReturn(false); $this->guestManager->method('isGuest') ->willReturn(true); + $this->appManager->method('cleanAppId') + ->willReturnCallback(fn (string $appId) => $appId); $user = $this->createStub(IUser::class); $this->assertTrue($this->appWhitelist->isUrlAllowed($user, '/apps/news/...'));