Merge pull request #26346 from J0WI/clean-auth-regex

Cleaner removePassword regex
This commit is contained in:
blizzz 2021-06-23 11:20:19 +02:00 committed by GitHub
commit ee7a484284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -39,7 +39,7 @@ class ErrorHandler {
* @return string
*/
protected static function removePassword($msg) {
return preg_replace('/\/\/(.*):(.*)@/', '//xxx:xxx@', $msg);
return preg_replace('#//(.*):(.*)@#', '//xxx:xxx@', $msg);
}
public static function register($debug = false) {

View file

@ -30,11 +30,15 @@ class ErrorHandlerTest extends \Test\TestCase {
*/
public function passwordProvider() {
return [
['user', 'password'],
['user@owncloud.org', 'password'],
['user', 'pass@word'],
['us:er', 'pass@word'],
['us:er', 'password'],
['user', '-C:R,w)@6*}'],
['user', 'pass:word'],
['user', 'pass@word'],
['user', 'password'],
['user:test@cloud', 'password'],
['user@owncloud.org', 'password'],
['user@test@owncloud.org', 'password'],
];
}