Merge pull request #56518 from nextcloud/jtr/feat-appmanager-cleanappid-log

This commit is contained in:
Kate 2026-01-08 11:42:04 +01:00 committed by GitHub
commit 8eb24155c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1031,7 +1031,13 @@ class AppManager implements IAppManager {
*/
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;
}
/**