Skip to content

Commit

Permalink
Cleaner removePassword regex
Browse files Browse the repository at this point in the history
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
  • Loading branch information
J0WI committed Mar 27, 2021
1 parent aec9c84 commit 5f468c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/private/Log/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions tests/lib/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
];
}

Expand Down

0 comments on commit 5f468c0

Please sign in to comment.