diff options
author | Jake Petroules <jake.petroules@qt.io> | 2016-05-31 09:17:46 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2016-06-07 15:58:19 +0000 |
commit | a9f70a366fdc47d58057116ae70c2d20dfa9c5f3 (patch) | |
tree | 8b2053338721f3340f66ca4807249b5c1082e34c | |
parent | 9739da5986d814ad6927ac09217a8cc593a29b1a (diff) |
Fix version validation for limits of 1,1.
It seems that the {0,} specifier is equivalent to {1,}, so work around
this.
Change-Id: I06b6b6a7eb9561f948c0b0ba6e83a66800234e74
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r-- | share/qbs/imports/qbs/ModUtils/utils.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index f019bec6f..2d6cdea8f 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -322,7 +322,10 @@ var PropertyValidator = (function () { this.addCustomValidator(propertyName, propertyValue, function (value) { if (typeof value !== "string") return false; - return value && value.match("^[0-9]+(\\.[0-9]+){" + ((minComponents - 1) || 0) + "," + ((maxComponents - 1) || "") + "}" + (!allowSuffixes ? "$" : "")) !== null; + var comps = ""; + if ((maxComponents - minComponents) > 0) + comps = "(\\.[0-9]+){" + ((minComponents - 1) || 0) + "," + ((maxComponents - 1) || "") + "}"; + return value && value.match("^[0-9]+" + comps + (!allowSuffixes ? "$" : "")) !== null; }, "must be a version number with " + (minComponents === maxComponents ? minComponents : (minComponents + " to " + maxComponents)) + (minComponents === maxComponents && minComponents === 1 |