Skip to content

Add check that URLs don't contain Windows path separators (\) #91

Open

Description

@ai

On widows file paths will include \ instead of / and source-map doesn’t convert slashes, but source map will work only with UNIX slashes.

We can fix it in app, but I think, that we need to fix it here, because every source-map node.js user must to repeat this fix.

Autoprefixer issue: nDmitry/grunt-autoprefixer#25

I can helps with PR, but how we should do this? Try to load path (it wil be in node.js and browserfy) and if path.sep == "\\" replace all \ to /?

Activity

  1. fitzgen commented on Feb 11, 2014

    @fitzgen
    Contributor

    We can't rely on the path module because it only exists in node, not the web or inside firefox.

    The reason we use / is because a source map's sources are URLs and URLs use /.

    I'm not against supporting alternative path separators as long as it doesn't negatively affect the existing 99% use case.

  2. ai commented on Feb 11, 2014

    @ai
    Author

    I mean, that if library user will set file to ..\build\main.css, source-map shoudl replace it to ../build/main.css in output map.

  3. ai commented on Feb 11, 2014

    @ai
    Author

    We can try to load path and if it will be loaded and will say, that path.sep == "\\" we will know, that we are in Windows’s node.js.

  4. sokra commented on Feb 12, 2014

    @sokra
    Contributor

    This library takes URLs as input. A path is not a valid input if it's separated with \. In my opinion it's the job of the application to pass a valid URL.

    Instead we should validate if the passed string is a valid URL.

  5. ai commented on Feb 12, 2014

    @ai
    Author

    @sokra OK, no problem, I make filter in my app.

    But we really need validation, because with issue is in many apps. For example, Rework also send file name, not URL: https://github.com/reworkcss/css-stringify/blob/master/lib/source-map-support.js#L22

  6. changed the title [-]No Windows support[/-] [+]Add validation to check that URLs don't contain Windows path separators (`\`)[/+] on Apr 18, 2021
  7. added
    feat
    on Apr 18, 2021
  8. changed the title [-]Add validation to check that URLs don't contain Windows path separators (`\`)[/-] [+]Add check that URLs don't contain Windows path separators (`\`)[/+] on Apr 18, 2021
  9. hybrist commented on Apr 18, 2021

    @hybrist
    Collaborator

    Updated title to reflect the expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions