Skip to content
This repository
Browse code

Fixed bug where script passed to jsdom.env contains spaces

  • Loading branch information...
commit da450d45364743768a33aff4659da47a2f6c0e27 1 parent d047be8
Tom Hudson TomNomNom authored
2  lib/jsdom/level2/html.js
@@ -143,7 +143,7 @@ core.resourceLoader = {
143 143 request.end();
144 144 },
145 145 readFile: function(url, callback) {
146   - fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/'), 'utf8', callback);
  146 + fs.readFile(url.replace(/^file:\/\//, "").replace(/^\/([a-z]):\//i, '$1:/').replace(/%20/g, ' '), 'utf8', callback);
147 147 }
148 148 };
149 149
11 test/level2/html.js
@@ -19796,5 +19796,16 @@ exports.tests = {
19796 19796
19797 19797 delete String.prototype.normalize;
19798 19798 test.done();
  19799 + },
  19800 +
  19801 + filename_with_spaces_in_script_tag_can_be_read: function(test) {
  19802 + jsdom.env(
  19803 + '<html><head></head><body></body></html>',
  19804 + ['./html/files/js/script with spaces.js'],
  19805 + function(err, window){
  19806 + test.strictEqual(err, null, "There should be no errors when using scripts with spaces in their filenames");
  19807 + test.done();
  19808 + }
  19809 + );
19799 19810 }
19800 19811 }
0  test/level2/html/files/js/script with spaces.js
No changes.

0 comments on commit da450d4

Please sign in to comment.
Something went wrong with that request. Please try again.