Skip to content

Commit

Permalink
contributor file fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chandan-reddy-k committed Oct 22, 2020
1 parent f60dede commit e4d1fd8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pages/contributors/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ export async function getServerSideProps({ params }) {
let contributorsArray = []
contributorFiles.map(filename => {
const filePath = path.join(contributorsDirectory, filename)
const fileContents = JSON.parse(fs.readFileSync(filePath, 'utf8'))
contributorsArray.push(fileContents)
try {
const fileContents = JSON.parse(fs.readFileSync(filePath, 'utf8'))
contributorsArray.push(fileContents)
}
catch (e) {
console.log('Error reading file -' + filename)
}

})

let obj = contributorsArray.find(o => o["github-username"] === `${params.slug}`);

return {
Expand Down

0 comments on commit e4d1fd8

Please sign in to comment.