pathchain 1.1.10 → 1.1.11

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.
Files changed (2) hide show
  1. package/maker.js +8 -8
  2. package/package.json +1 -1
package/maker.js CHANGED
@@ -349,6 +349,11 @@ function link(target, prev, next, author, ancestor, format = 'MM DD YYYY HH:mm:S
349
349
  }
350
350
  }
351
351
 
352
+ // Checking target existance
353
+ if (!checker.checkFile(`files/${target}`)) {
354
+ return "Target was not found!";
355
+ }
356
+
352
357
  // Homogenize the author.
353
358
  // Break down the target address
354
359
  // Make a copy of it inside *author* address if it is not public or if the original author is different than *author*
@@ -358,18 +363,13 @@ function link(target, prev, next, author, ancestor, format = 'MM DD YYYY HH:mm:S
358
363
  const register = dt.format(new Date(), dt.compile(format, true));
359
364
  const register_moment_hash = moment(register, 0, 0, 0, 0, 0, format);
360
365
 
361
-
366
+ // Generate a unique hash for this link
367
+ const link_hash = sha256(`${register_moment_hash}_${author}_${prev}_${next}`);
368
+
362
369
  // Set default values if not provided
363
370
  if (ancestor === "") { ancestor = link_hash; }
364
371
  if (prev === "") { prev = link_hash; }
365
372
  if (next === "") { next = link_hash; }
366
-
367
- // Generate a unique hash for this link
368
- const link_hash = sha256(`${register_moment_hash}_${author}_${prev}_${next}`);
369
-
370
- if (!checker.checkFile(`files/${target}`)) {
371
- return "Target was not found!";
372
- }
373
373
 
374
374
  // Encode the link data into a protocol buffer
375
375
  const buffer = link_pb.link.encode({
package/package.json CHANGED
@@ -34,5 +34,5 @@
34
34
  "deprecated": false,
35
35
  "description": "![image](https://user-images.githubusercontent.com/104391124/282268780-cbbc1ee6-8d97-4d80-b896-66ae3eb723dd.png)",
36
36
  "name": "pathchain",
37
- "version": "1.1.10"
37
+ "version": "1.1.11"
38
38
  }