Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.23k stars 1.02k forks source link

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

Open rickymohk opened 1 year ago

rickymohk commented 1 year ago

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 https://github.com/Squirrel/Squirrel.Windows/blob/5ee2566c4b0a847a17926dfb3d840ec7159651fa/src/Squirrel/ReleaseExtensions.cs#L14 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

caesay commented 1 year ago

This version of squirrel does not support semver2 syntax in several places. The StubExecutable, old Nuget library, and the code you found all expect semver1. It is a fairly big change to fix this in all places - and it's something that has been fixed in my fork.

rickymohk commented 1 year ago

Thank you for explaining. I think I would explicitly rename my nupkg files then.