Skip to content

Commit

Permalink
fix: if a file is empty, ignore hash
Browse files Browse the repository at this point in the history
  • Loading branch information
sabhas committed Oct 9, 2022
1 parent 9913743 commit 22c3f37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/file/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,13 @@ export const hashFileFolder = async (
) => {
if (!(await isFolder(resourcePath))) {
const fileContent = fs.readFileSync(resourcePath)
const hash = createHash('md5')
hash.update(fileContent)
const generatedHash = hash.digest('hex').toUpperCase()
let generatedHash = ''

if (fileContent.length) {
const hash = createHash('md5')
hash.update(fileContent)
generatedHash = hash.digest('hex').toUpperCase()
}

return [
...hashedResources,
Expand Down
Empty file.

0 comments on commit 22c3f37

Please sign in to comment.