Skip to content

Commit 76dae2b

Browse files
committed
fix: attempt to normalize content for signature so crlf endlines are treated as lf
1 parent 5d222f9 commit 76dae2b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/helpers/serverTsSignature.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ const knownSignatures = require('./knownServerTsSignatures.json')
77
* @param {string} content Text of module to generate signature for
88
* @returns {string} Signature
99
*/
10-
const generateServerTsSignature = (content) => createHash('sha256').update(content).digest('hex')
10+
const generateServerTsSignature = (content) => {
11+
// windows or unix line endings should not affect the signature
12+
const normalizedContent = content.replaceAll('\r', '')
13+
14+
return createHash('sha256').update(normalizedContent).digest('hex')
15+
}
1116

1217
module.exports.generateServerTsSignature = generateServerTsSignature
1318

0 commit comments

Comments
 (0)