Skip to content

Local paths without protocol / host part are not loaded  #1272

@losnir

Description

@losnir

This is a bug introduced in v1.3.2, with the extractUrlParts function. When the path does not have a protocol / host part (local path) then the result of the regular expression inside that function would be undefined, and that would be prepended to the path, thus making it unable to be loaded.

Reproduction steps:

  • Include the latest less.js inside your WebKit application (this was discovered in matthewdl/Crunch)
  • Manually invoke the parser and the compiler:
var parser = new(less.Parser);

parser.parse('@import "files/demo.less";', function (err, tree) {
    if (err) { return console.error(err) }
    console.log(tree.toCSS());
});

The href variable inside loadStyleSheet function would be prepended with undefined, and the file would not be loaded (404).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions