Skip to content

Windows + Literate => Regex crash due to abspath escaped characters #181

Open
@behinger

Description

I get an error on the regexp ERROR: PCRE compilation error: \ at end of pattern for the literate part when running LiveServer.jl from several windows systems.

The reasons seems to lay in:
https://github.com/tlienart/LiveServer.jl/blob/eec3d5b23d16e296ba55c4f99084c1814bee5165/src/utils.jl#L249
which translates something like literate="Foo" to c:\\Foo\\. Unfortunately, this is not a correct regular expression, and thus later at
https://github.com/tlienart/LiveServer.jl/blob/eec3d5b23d16e296ba55c4f99084c1814bee5165/src/utils.jl#L165

the Regex(literate) throws the error (at what letter exactly is a bit surprisingly different on different windows machines / paths we tested... but haven't systematically tested it either).

I'm not entirely sure how to fix it, because I dont fully understand the function in L165. Maybe one can escape the sequence better?

PS: You can try that Regex("c:\\Foo\\") throws an error, or on windows machine Regex(abspath(".")) - note that sometimes it only complains about the last "\", but if you are unlikely and hit some special escaped things like "\F", it fails earlier ;)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions