8000 GitPath parser invalid match · Issue #39 · gitrows/gitrows · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
GitPath parser invalid match #39
Open
@dleeftink

Description

@dleeftink

At the line:

const regex = /^(?:(?:(?:(?:@)([\w]+)\/)?(?:([\w-]+)?\/)([\w-\.]+)(?:(?:#)([\w-]+))?)|(?:\.))\/?([\w-\/.]*(?:\.([\w]{2,4}))|[\w\/]*)?(?:\/)?([\w]+)?/mg;

It seems the # should be an escaped colon \: instead to properly parse the repository:branch part of provided paths. Additionally, the hyphens - might need additional escaping in the bracketed character classes.

Suggested _parsePath regex:

- /^(?:(?:(?:(?:@)([\w]+)\/)?(?:([\w-]+)?\/)([\w-\.]+)(?:(?:#)([\w-]+))?)|(?:\.))\/?([\w-\/.]*(?:\.([\w]{2,4}))|[\w\/]*)?(?:\/)?([\w]+)?/mg;
+ /^(?:(?:(?:(?:@)([\w]+)\/)?(?:([\w\-]+)?\/)([\w\-\.]+)(?:(?:\:)([\w\-]+))?)|(?:\.))\/?([\w-\/.]*(?:\.([\w]{2,4}))|[\w\/]*)?(?:\/)?([\w]+)?/mg;

I wonder why the # was used instead of an escaped colon?

Metadata

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

      0