If git's author name does not contain valid utf-8 bytes, skip the author

lookup in the database, which would otherwise only bring up errors.
This commit is contained in:
Thomas Keller 2011-06-15 13:50:02 +02:00
parent 8e4f828cc6
commit 4879d64989
2 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,8 @@ or newer to properly run this version of Indefero!
ATTENTION: This needs Pluf 46b7f251 or newer!
- Fix the branch links users of the Subversion frontend get when they enter a wrong revision
and only display this list if there are any branches available for all SCMs
- If git's author name is not encoded in an UTF-8 compatible encoding, skip the author lookup,
as we have no information what the author string is actually encoded in
## Documentation

View File

@ -346,6 +346,14 @@ class IDF_Scm_Git extends IDF_Scm
if (!preg_match('/<(.*)>/', $author, $match)) {
return null;
}
// FIXME: newer git versions know a i18n.commitencoding setting which
// leads to another header, "encoding", with which we _could_ try to
// decode the string into utf8. Unfortunately this does not always
// work, especially not in older repos, so we would then still have
// to supply some fallback.
if (!mb_check_encoding($match[1], 'UTF-8')) {
return null;
}
$sql = new Pluf_SQL('login=%s', array($match[1]));
$users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen()));
if ($users->count() > 0) {