Skip to content

The _versionRegex is not correct and fail to identify semver with dot separated prerelease identifiers #1829

@rickymohk

Description

@rickymohk

Squirrel version(s)
Squirrel.Windows 2.0.1

Description
I am using electron-forge, which uses electron-winstaller which uses Squirrel.Windows 2.0.1, to try to build delta nupkg. My app version string follows the semver standard like 2.0.0-rc.2, with dot separated prerelease identifiers. It throws exception in SyncRelease. This is because the regex in

static readonly Regex _versionRegex = new Regex(@"\d+(\.\d+){0,3}(-[A-Za-z][0-9A-Za-z-]*)?$", RegexOptions.Compiled);

does not correctly capture the version string. It does not account for the "." character in the prerelease part, let alone the "+" character for the build metadata part.

Steps to recreate

  1. SyncRelease with a version string 2.0.0-rc.1 in the file name inside RELESAES file

Expected behavior
version string should be "2.0.0-rc.2"

Actual behavior
version string become "2"

Additional information
Why don't use the suggested regex from semver?
https://semver.org/spec/v2.0.0.html#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string

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