From 1a6f17fb54e0cfe48c7a2504fcdc4973d7a5c01d Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 26 May 2023 10:51:31 -0700 Subject: [PATCH] util: use native PHP user agent Signed-off-by: Varun Patil --- lib/Util.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/Util.php b/lib/Util.php index 06b51e68..2f403c0a 100644 --- a/lib/Util.php +++ b/lib/Util.php @@ -412,9 +412,8 @@ class Util */ public static function callerIsNative(): bool { - $userAgent = \OC::$server->get(\OCP\IRequest::class)->getHeader('User-Agent'); - - return false !== strpos($userAgent, 'MemoriesNative'); + // Should not use IRequest here since this method is called during registration + return false !== strpos($_SERVER['HTTP_USER_AGENT'] ?? '', 'MemoriesNative'); } /**