@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.
@@ -4442,6 +4442,10 @@ function kw_set_dict_value(gobj, kw, path, value) {
4442
4442
  log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): path empty`);
4443
4443
  return -1;
4444
4444
  }
4445
+ if (path.split("`").includes("")) {
4446
+ log_error(`${gobj ? gobj_short_name(gobj) + ": " : ""}kw_set_dict_value(): empty segment in path: '${path}'`);
4447
+ return -1;
4448
+ }
4445
4449
  let ss = path.split("`");
4446
4450
  let len = ss.length;
4447
4451
  for (let i = 0; i < len; i++) {
@@ -5245,15 +5249,18 @@ function jdb_update(jdb, topic_name, path, kw) {
5245
5249
  log_error("jdb_update: topic not found: " + topic_name);
5246
5250
  return null;
5247
5251
  }
5248
- if (empty_string(kw["id"])) {
5249
- log_error("jdb_update: record without id: " + kw);
5250
- trace_msg(kw);
5252
+ if (!is_object(kw) || empty_string(kw["id"])) {
5253
+ log_error(`jdb_update: record without id: ${JSON.stringify(kw)}`);
5251
5254
  return null;
5252
5255
  }
5253
5256
  if (!is_string(path)) {
5254
5257
  log_error(`jdb_update: path must be a string: ${String(path)}`);
5255
5258
  return null;
5256
5259
  }
5260
+ if (path !== "" && path.split("`").includes("")) {
5261
+ log_error(`jdb_update: empty segment in path: '${path}'`);
5262
+ return null;
5263
+ }
5257
5264
  let ids = path.split("`");
5258
5265
  let id;
5259
5266
  let v = topic;
@@ -5295,15 +5302,18 @@ function jdb_delete(jdb, topic_name, path, kw) {
5295
5302
  log_error("jdb_delete: topic not found: " + topic_name);
5296
5303
  return null;
5297
5304
  }
5298
- if (empty_string(kw["id"])) {
5299
- log_error("jdb_delete: record without id: " + kw);
5300
- trace_msg(kw);
5305
+ if (!is_object(kw) || empty_string(kw["id"])) {
5306
+ log_error(`jdb_delete: record without id: ${JSON.stringify(kw)}`);
5301
5307
  return null;
5302
5308
  }
5303
5309
  if (!is_string(path)) {
5304
5310
  log_error(`jdb_delete: path must be a string: ${String(path)}`);
5305
5311
  return null;
5306
5312
  }
5313
+ if (path !== "" && path.split("`").includes("")) {
5314
+ log_error(`jdb_delete: empty segment in path: '${path}'`);
5315
+ return null;
5316
+ }
5307
5317
  let ids = path.split("`");
5308
5318
  let id;
5309
5319
  let v = topic;