Skip to content

Commit 8eb2415

Browse files
Merge pull request #56518 from nextcloud/jtr/feat-appmanager-cleanappid-log
2 parents 377de23 + 24ec0e8 commit 8eb2415

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/App/AppManager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,13 @@ public function isBackendRequired(string $backend): bool {
10311031
*/
10321032
public function cleanAppId(string $app): string {
10331033
/* Only lowercase alphanumeric is allowed */
1034-
return preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app);
1034+
$cleanAppId = preg_replace('/(^[0-9_-]+|[^a-z0-9_-]+|[_-]+$)/', '', $app, -1, $count);
1035+
if ($count > 0) {
1036+
$this->logger->debug('Only lowercase alphanumeric characters are allowed in appIds; check paths of installed app [' . $count . ' characters replaced]', [
1037+
'app' => $cleanAppId, // safer to log $cleanAppId even if it makes more challenging to troubleshooting (part of why character count is at least logged)
1038+
]);
1039+
}
1040+
return $cleanAppId;
10351041
}
10361042

10371043
/**

0 commit comments

Comments
 (0)