@yuneta/gobj-js 7.26.11 → 7.26.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4443,6 +4443,10 @@ function kw_set_dict_value(gobj, kw, path, value) {
4443
4443
  log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): path empty`);
4444
4444
  return -1;
4445
4445
  }
4446
+ if (path.split("`").includes("")) {
4447
+ log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): empty segment in path: '${path}'`);
4448
+ return -1;
4449
+ }
4446
4450
  let ss = path.split("`");
4447
4451
  let len = ss.length;
4448
4452
  for (let i = 0; i < len; i++) {
@@ -5246,15 +5250,18 @@ function jdb_update(jdb, topic_name, path, kw) {
5246
5250
  log_error("jdb_update: topic not found: " + topic_name);
5247
5251
  return null;
5248
5252
  }
5249
- if (empty_string(kw["id"])) {
5250
- log_error("jdb_update: record without id: " + kw);
5251
- trace_msg(kw);
5253
+ if (!is_object(kw) || empty_string(kw["id"])) {
5254
+ log_error(`jdb_update: record without id: ${JSON.stringify(kw)}`);
5252
5255
  return null;
5253
5256
  }
5254
5257
  if (!is_string(path)) {
5255
5258
  log_error(`jdb_update: path must be a string: ${String(path)}`);
5256
5259
  return null;
5257
5260
  }
5261
+ if (path !== "" && path.split("`").includes("")) {
5262
+ log_error(`jdb_update: empty segment in path: '${path}'`);
5263
+ return null;
5264
+ }
5258
5265
  let ids = path.split("`");
5259
5266
  let id;
5260
5267
  let v = topic;
@@ -5296,15 +5303,18 @@ function jdb_delete(jdb, topic_name, path, kw) {
5296
5303
  log_error("jdb_delete: topic not found: " + topic_name);
5297
5304
  return null;
5298
5305
  }
5299
- if (empty_string(kw["id"])) {
5300
- log_error("jdb_delete: record without id: " + kw);
5301
- trace_msg(kw);
5306
+ if (!is_object(kw) || empty_string(kw["id"])) {
5307
+ log_error(`jdb_delete: record without id: ${JSON.stringify(kw)}`);
5302
5308
  return null;
5303
5309
  }
5304
5310
  if (!is_string(path)) {
5305
5311
  log_error(`jdb_delete: path must be a string: ${String(path)}`);
5306
5312
  return null;
5307
5313
  }
5314
+ if (path !== "" && path.split("`").includes("")) {
5315
+ log_error(`jdb_delete: empty segment in path: '${path}'`);
5316
+ return null;
5317
+ }
5308
5318
  let ids = path.split("`");
5309
5319
  let id;
5310
5320
  let v = topic;