Skip to content
Snippets Groups Projects
Commit 4d986aa8 authored by Roger W Feese's avatar Roger W Feese
Browse files

Add additional checks for existence of files when loading notes.

parent 4f3857ce
No related branches found
No related tags found
1 merge request!30Projects task 87
......@@ -146,22 +146,26 @@ class Bulletin_ViewController extends Requests_ViewController
$parentCommit = $repo->getParentCommitForSection($section);
$contents = $repo->getFileNotes(
'/data/' . $repo->getFilePathForSection($section), $parentCommit
);
$originalFileContents = $repo->getFileContents('/data/' . $repo->getFilePathForSection($section), $parentCommit);
// Original file content
$originalFileContents = "";
$originalFilePath = $repo->getFilePathForSection($section);
// Only attempt to get notes if getFilePathForSection actually returns a value
if(!empty($originalFilePath)){
$originalFileContents = $repo->getFileContents('/data/' . $originalFilePath, $parentCommit);
$originalFileContents = Bulletin_SectionModel::getBodyHtml($originalFileContents);
//$originalFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::format($originalFileContents);
$originalFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($originalFileContents);
}
$requestOriginalFileContents[$request->getId()] = $originalFileContents;
$proposedFileContents = $repo->getFileNotes(
'/data/' . $repo->getFilePathForSection($section), 'request-' . $request->getId()
);
// Proposed file content
$proposedFileContents = "";
$proposedFilePath = $repo->getFilePathForSection($section);
// Only attempt to get notes if getFilePathForSection actually returns a value
if(!empty($proposedFilePath)){
$proposedFileContents = $repo->getFileNotes('/data/' . $proposedFilePath, 'request-' . $request->getId());
$proposedFileContents = Bulletin_SectionModel::getBodyHtml($proposedFileContents);
//$proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::format($proposedFileContents);
$proposedFileContents = UNL_UndergraduateBulletin_EPUB_Utilities::convertHeadings($proposedFileContents);
}
$requestProposedFileContents[$request->getId()] = $proposedFileContents;
}
......
......@@ -67,7 +67,8 @@ class Bulletin_RepositoryModel
$filepath = $this->_repoPath . '/' . $path;
$this->_checkout($branch);
if(file_exists($filepath)){
//make sure path exists and it is a file
if(file_exists($filepath) && is_file($filepath)){
$this->_git_exec('hash-object ' . escapeshellarg($filepath), $object);
$this->_git_exec('notes --ref=creq show ' . escapeshellarg($object), $note);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment