Skip to content

Commit

Permalink
Merge pull request #145 from bcgov/bugfix/appmount
Browse files Browse the repository at this point in the history
Fix getGitRevision mishandling HEAD file read
  • Loading branch information
kyle1morel authored Nov 3, 2023
2 parents 9351975 + 34c3709 commit 5780f57
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/src/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ export function getGitRevision(): string {
.toString()
.trim();

let fileRead: string = '';
if (head.indexOf(':') === -1) {
fileRead = readFileSync(join(__dirname, `${gitDir}/${head.substring(5)}`), 'utf8')
return head;
} else {
return readFileSync(join(__dirname, `${gitDir}/${head.substring(5)}`), 'utf8')
.toString()
.trim();
}

return head.indexOf(':') === -1 ? head : (fileRead as string);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) {
log.warn(err.message, { function: 'getGitRevision' });
Expand Down

0 comments on commit 5780f57

Please sign in to comment.