Convert to custom encoding for diffusion blame views
Summary: If a repository is configured with a custom encoding, it wasn't respected by DiffusionGitFileContentQuery making all views with non-UTF8 characters fail. Check if we have a custom encoding and encode if any it set. NOTE: This only works for Git repositories. Test Plan: Browsed a repository with custom encoding before and after this patch. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T452 Differential Revision: https://secure.phabricator.com/D3251
This commit is contained in:
@@ -27,7 +27,17 @@ abstract class DiffusionFileContentQuery extends DiffusionQuery {
|
||||
}
|
||||
|
||||
final public function loadFileContent() {
|
||||
return $this->fileContent = $this->executeQuery();
|
||||
$this->fileContent = $this->executeQuery();
|
||||
|
||||
$repository = $this->getRequest()->getRepository();
|
||||
$try_encoding = $repository->getDetail('encoding');
|
||||
if ($try_encoding) {
|
||||
$this->fileContent->setCorpus(
|
||||
phutil_utf8_convert(
|
||||
$this->fileContent->getCorpus(), "UTF-8", $try_encoding));
|
||||
}
|
||||
|
||||
return $this->fileContent;
|
||||
}
|
||||
|
||||
final public function getRawData() {
|
||||
|
||||
Reference in New Issue
Block a user