Skip to content

Commit 0bfb454

Browse files
authored
Omit integrity hashes for local vendor plugins (#964)
1 parent 1746ed1 commit 0bfb454

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

scripts/events/lib/vendors.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ module.exports = hexo => {
4949
});
5050
vendors[key] = {
5151
url : links[plugins] || links.cdnjs,
52-
integrity: value.integrity
52+
// Subresource Integrity only adds value for cross-origin CDN assets.
53+
// The hashes in _vendors.yml are computed for the CDN builds; when
54+
// self-hosting (`plugins: local`) the files are served same-origin and
55+
// may differ byte-for-byte from those builds (e.g. a newer bundled
56+
// version), so a hardcoded hash would make the browser block them.
57+
// Omit integrity for local assets.
58+
integrity: plugins === 'local' ? undefined : value.integrity
5359
};
5460
}
5561
};

0 commit comments

Comments
 (0)