From 24ec0e85e5e4b1e937855371da4adb766a93ea6b Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 18 Nov 2025 17:26:01 -0500 Subject: [PATCH] feat(AppManager): log when cleanAppId drops invalid chars Log a debug message if invalid characters are replaced in app IDs. Signed-off-by: Josh --- lib/private/App/AppManager.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 8137805ac3488..655d80e9b6c91 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -1031,7 +1031,13 @@ public function isBackendRequired(string $backend): bool { */ public function cleanAppId(string $app): string { /* Only lowercase alphanumeric is allowed */ - return preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app); + $cleanAppId = preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app, -1, $count); + if ($count > 0) { + $this->logger->debug('Only lowercase alphanumeric characters are allowed in appIds; check paths of installed app [' . $count . ' characters replaced]', [ + 'app' => $cleanAppId, // safer to log $cleanAppId even if it makes more challenging to troubleshooting (part of why character count is at least logged) + ]); + } + return $cleanAppId; } /**