From a4501e6fbdd2bfdb6732e50698fa9e068ec8a253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 27 Nov 2023 16:37:27 +0100 Subject: [PATCH] fix: enforce view mode on mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/WOPI/Parser.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/WOPI/Parser.php b/lib/WOPI/Parser.php index c15548960..0096abbdc 100755 --- a/lib/WOPI/Parser.php +++ b/lib/WOPI/Parser.php @@ -182,6 +182,11 @@ public function getUrlSrcForFile(File $file, bool $edit): string { 'internal-' . $fallbackProtocol, ]; + $userAgent = $_SERVER["HTTP_USER_AGENT"]; + if (preg_match("/(android|mobile)/i", $userAgent)) { + $edit = false; + } + $actions = [ $edit && $file->getSize() === 0 ? self::ACTION_EDITNEW : null, $edit ? self::ACTION_EDIT : null,