mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
feat(AppManager): log when cleanAppId drops invalid chars
Log a debug message if invalid characters are replaced in app IDs. Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
parent
6a2e0f819c
commit
24ec0e85e5
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue