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