From 3dfad939ad97a7beeda1703e496b7f641f169922 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 10 Oct 2021 23:21:14 +0200 Subject: [PATCH] fix, semver patch component mandatory some dub package omit it --- CHANGELOG.md | 1 + src/u_semver.pas | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac05ecf8..d142dc31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - diff dialog: the content reloaded matched to the state when the dialog was shown, not when closed. (#97) - editor, debugging: during a debugging session, wrong icon displayed when a breakpoint is removed. +- DUB projects: version number without the patch component were not accepted. # v3.9.12 diff --git a/src/u_semver.pas b/src/u_semver.pas index 3e3b6dd3..32d82051 100644 --- a/src/u_semver.pas +++ b/src/u_semver.pas @@ -80,8 +80,6 @@ var r: TStringRange = (ptr:nil; pos:0; len: 0); begin resetFields(); - if throw and (text.length < 6) then - error('Invalid semVer format, at least 6 characters expected'); r.init(text); if throw and (r.front <> 'v') then error('Invalid semVer format, the text must start with "v"'); @@ -90,9 +88,8 @@ begin if throw and r.empty then error('Invalid semVer format, minor and patch miss'); fMinor := r.popFront^.takeUntil('.').yield.ToInteger; - if throw and r.empty then - error('Invalid semVer format, the patch misses'); - fPatch := r.popFront^.takeWhile(['0'..'9']).yield.ToInteger; + if not r.empty then + fPatch := r.popFront^.takeWhile(['0'..'9']).yield.ToInteger; if not r.empty then fAdditional := r.popFront^.takeUntil(#0).yield; fValid := true;