@yuneta/gobj-js 7.26.11 → 7.26.12

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.
@@ -5249,15 +5249,18 @@
5249
5249
  log_error("jdb_update: topic not found: " + topic_name);
5250
5250
  return null;
5251
5251
  }
5252
- if (empty_string(kw["id"])) {
5253
- log_error("jdb_update: record without id: " + kw);
5254
- trace_msg(kw);
5252
+ if (!is_object(kw) || empty_string(kw["id"])) {
5253
+ log_error(`jdb_update: record without id: ${JSON.stringify(kw)}`);
5255
5254
  return null;
5256
5255
  }
5257
5256
  if (!is_string(path)) {
5258
5257
  log_error(`jdb_update: path must be a string: ${String(path)}`);
5259
5258
  return null;
5260
5259
  }
5260
+ if (path !== "" && path.split("`").includes("")) {
5261
+ log_error(`jdb_update: empty segment in path: '${path}'`);
5262
+ return null;
5263
+ }
5261
5264
  let ids = path.split("`");
5262
5265
  let id;
5263
5266
  let v = topic;
@@ -5299,15 +5302,18 @@
5299
5302
  log_error("jdb_delete: topic not found: " + topic_name);
5300
5303
  return null;
5301
5304
  }
5302
- if (empty_string(kw["id"])) {
5303
- log_error("jdb_delete: record without id: " + kw);
5304
- trace_msg(kw);
5305
+ if (!is_object(kw) || empty_string(kw["id"])) {
5306
+ log_error(`jdb_delete: record without id: ${JSON.stringify(kw)}`);
5305
5307
  return null;
5306
5308
  }
5307
5309
  if (!is_string(path)) {
5308
5310
  log_error(`jdb_delete: path must be a string: ${String(path)}`);
5309
5311
  return null;
5310
5312
  }
5313
+ if (path !== "" && path.split("`").includes("")) {
5314
+ log_error(`jdb_delete: empty segment in path: '${path}'`);
5315
+ return null;
5316
+ }
5311
5317
  let ids = path.split("`");
5312
5318
  let id;
5313
5319
  let v = topic;