Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post fix for incorrect type #1827

Merged
merged 1 commit into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ exports.sendScript = function (aReq, aRes, aNext) {
}

hashSRI = aScript.hash
? 'sha512-' + Buffer.from(aScript.hash).toString('base64')
? 'sha512-' + Buffer.from(aScript.hash, 'hex').toString('base64')
: 'undefined';

// HTTP/1.1 Caching
Expand Down Expand Up @@ -687,6 +687,7 @@ exports.sendScript = function (aReq, aRes, aNext) {
source = chunks.join(''); // NOTE: Watchpoint

// Send the script
aRes.set('Access-Control-Allow-Origin', '*');
aRes.set('Content-Type', 'text/javascript; charset=UTF-8');
aStream.setEncoding('utf8');

Expand Down
2 changes: 1 addition & 1 deletion libs/modelParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ var parseScript = function (aScript) {
if (script.hash) {
// NOTE: May be absent in dev DB but should not be in pro DB
script.hashShort = script.hash.substr(0, 7);
script.hashSRI = 'sha512-' + Buffer.from(script.hash).toString('base64');
script.hashSRI = 'sha512-' + Buffer.from(script.hash, 'hex').toString('base64');
}

if (script.created && script.updated && script.created.toString() !== script.updated.toString()) {
Expand Down