less.js icon indicating copy to clipboard operation
less.js copied to clipboard

fix: file path is not an absolute path when startswith "#"

Open YourWildDad opened this issue 3 years ago • 1 comments

What:

I don't know why this function thinks that the path starting with '#' an absolute path, but according to the definition of absolute path, this is wrong, and the path name starting with '#' return false in the built-in functions in many languages

Why:

Same as nodejs built-in implementation require('path').isAbsolute(). The file path starting with '#' is not an absolute path.

How:

Modify the regular expression to remove the match at the starting of '#'

Checklist:

  • [ ] Documentation
  • [ ] Added/updated unit tests
  • [x] Code complete

YourWildDad avatar Jun 30 '22 13:06 YourWildDad

Is there a real-world use case where this has caused a problem? In Less, this function determines if the URL should be re-written, which a URL starting with # would not.

matthew-dean avatar Aug 20 '22 17:08 matthew-dean