mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
71391987f7
This commit adds the delimiters ^ and $ to the regex that matches the MIME types for `data:` URLs. PR-URL: https://github.com/nodejs/node/pull/49104 Fixes: https://github.com/nodejs/node/issues/48957 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
25 lines
891 B
JavaScript
25 lines
891 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
(async () => {
|
|
await assert.rejects(import('data:text/plain,export default0'), {
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
message:
|
|
'Unknown module format: text/plain for URL data:text/plain,' +
|
|
'export default0',
|
|
});
|
|
await assert.rejects(import('data:text/plain;base64,'), {
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
message:
|
|
'Unknown module format: text/plain for URL data:text/plain;base64,',
|
|
});
|
|
await assert.rejects(import('data:text/css,.error { color: red; }'), {
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
message: 'Unknown module format: text/css for URL data:text/css,.error { color: red; }',
|
|
});
|
|
await assert.rejects(import('data:WRONGtext/javascriptFORMAT,console.log("hello!");'), {
|
|
code: 'ERR_UNKNOWN_MODULE_FORMAT',
|
|
});
|
|
})().then(common.mustCall());
|