Browse Source

take the first occurence of delim and compute id and type accordingly. This works with the case when the id has the delim character in it.

pull/36/head
Harish Krishna 10 years ago
parent
commit
6ac839f37b
  1. 6
      sanitiser/_id.js

6
sanitiser/_id.js

@ -42,9 +42,9 @@ function sanitize( req ){
return errormessage(null, 'invalid: must be of the format type:id for ex: \'geoname:4163334\''); return errormessage(null, 'invalid: must be of the format type:id for ex: \'geoname:4163334\'');
} }
var param = thisparam.split(delim); var param_index = thisparam.indexOf(delim);
var type= param[0]; var type = thisparam.substring(0, param_index );
var id = param[1]; var id = thisparam.substring(param_index + 1);
// id text // id text
if('string' !== typeof id || !id.length){ if('string' !== typeof id || !id.length){

Loading…
Cancel
Save