Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

smartos-live#108 fix failed match on quick lookup if property type is…

… not string (Thanks MerlinDMC)
  • Loading branch information...
commit ffae0240e84f143d4a756cdbcd947f0824b1bb5a 1 parent f3bfdb3
Josh Wilsdon joshwilsdon authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/vm/node_modules/VM.js
10 src/vm/node_modules/VM.js
View
@@ -2190,6 +2190,7 @@ exports.lookup = function (search, options, callback) {
var full_results = [];
var match;
var regex;
+ var source;
var target;
var u;
var z;
@@ -2203,14 +2204,18 @@ exports.lookup = function (search, options, callback) {
match = true;
for (key in search) {
regex = false;
+ // force field type to string so that earlier transformed
+ // number fields get back their match method and the
+ // strict not-equal operator will work on number lookups
+ source = '' + z[key];
target = search[key];
if (target[0] === '~') {
target = new RegExp(target.substr(1), 'i');
regex = true;
}
- if (regex && !z[key].match(target)) {
+ if (regex && !source.match(target)) {
match = false;
- } else if (!regex && (z[key] !== search[key])) {
+ } else if (!regex && (source !== search[key])) {
match = false;
}
}
@@ -3535,7 +3540,6 @@ function validRecordSize(candidate)
// update is assumed.
function checkPayloadProperties(payload, vmobj, callback)
{
- var allowed = {};
var array_fields = [
'add_nics', 'update_nics', 'remove_nics',
'add_disks', 'update_disks', 'remove_disks',
Please sign in to comment.
Something went wrong with that request. Please try again.