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