mirror of
https://github.com/nextcloud/server.git
synced 2026-03-25 03:43:45 -04:00
Merge pull request #56518 from nextcloud/jtr/feat-appmanager-cleanappid-log
This commit is contained in:
commit
8eb24155c4
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