@tryghost/mg-substack 0.7.0 → 0.7.2

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2023 Ghost Foundation
3
+ Copyright (c) 2013-2025 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -149,4 +149,4 @@ yarn dev substack <pathToZip>
149
149
 
150
150
  # Copyright & License
151
151
 
152
- Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
152
+ Copyright (c) 2013-2025 Ghost Foundation - Released under the [MIT license](LICENSE).
package/lib/process.js CHANGED
@@ -416,14 +416,22 @@ const processContent = (post, siteUrl, options) => {
416
416
 
417
417
  $html('.digest-post-embed').each((i, el) => {
418
418
  const attrsRaw = $(el).attr('data-attrs');
419
- const attrs = JSON.parse(attrsRaw);
419
+
420
+ let attrs;
421
+
422
+ // Return early if JSON is invalid
423
+ try {
424
+ attrs = JSON.parse(attrsRaw);
425
+ } catch (error) {
426
+ return;
427
+ }
420
428
 
421
429
  const postUrl = attrs.canonical_url;
422
430
  const postTitle = attrs.title;
423
431
  const postCaption = attrs.caption;
424
432
  const postImage = attrs.cover_image;
425
433
  const postIcon = attrs.publication_logo_url;
426
- const postAuthor = attrs.publishedBylines[0].name;
434
+ const postAuthor = attrs?.publishedBylines[0]?.name ?? null;
427
435
  const postPubName = attrs.publication_name;
428
436
 
429
437
  let cardOpts = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-substack",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-substack",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "@tryghost/debug": "0.1.33",
29
29
  "@tryghost/errors": "1.3.6",
30
30
  "@tryghost/kg-default-cards": "10.0.9",
31
- "@tryghost/mg-fs-utils": "0.15.1",
31
+ "@tryghost/mg-fs-utils": "0.15.2",
32
32
  "@tryghost/string": "0.2.12",
33
33
  "cheerio": "1.0.0-rc.12",
34
34
  "he": "1.2.0",
@@ -37,5 +37,5 @@
37
37
  "simple-dom": "1.4.0",
38
38
  "srcset": "5.0.1"
39
39
  },
40
- "gitHead": "f8384df52f15e14456c33fea4de8dac2408376a3"
40
+ "gitHead": "1a065fa46d2a5a0a65e51716d154d5577693e792"
41
41
  }