@tryghost/mg-substack 0.8.5 → 0.8.7

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/lib/process.js +11 -2
  2. package/package.json +5 -6
package/lib/process.js CHANGED
@@ -630,6 +630,10 @@ const processContent = (post, siteUrl, options) => {
630
630
  let href = $(anchor).attr('href');
631
631
  let linkRegex = new RegExp(`^(${siteUrl})?(/subscribe)(.*)`, 'gi');
632
632
 
633
+ if (!href) {
634
+ return;
635
+ }
636
+
633
637
  let matches = href.replace(linkRegex, '$2');
634
638
 
635
639
  if (matches === '/subscribe') {
@@ -640,7 +644,7 @@ const processContent = (post, siteUrl, options) => {
640
644
 
641
645
  // Replace any signup forms with a Portal signup button
642
646
  if (options.subscribeLink) {
643
- $html('.subscription-widget-wrap').each((i, div) => {
647
+ $html('.subscription-widget-wrap, .subscription-widget-wrap-editor').each((i, div) => {
644
648
  const hasForm = $(div).find('form');
645
649
 
646
650
  if (hasForm.length) {
@@ -697,7 +701,12 @@ const processContent = (post, siteUrl, options) => {
697
701
  let $script = $('<script async="" src="//www.instagram.com/embed.js"></script>');
698
702
  let $figure = $('<figure class="instagram"></figure>');
699
703
 
700
- $iframe.attr('src', `${src}embed/captioned/`);
704
+ // Trim the trailing slash from src if it exists
705
+ if (src.endsWith('/')) {
706
+ src = src.slice(0, -1);
707
+ }
708
+
709
+ $iframe.attr('src', `${src}/embed/captioned/`);
701
710
  $figure.append($iframe);
702
711
  $figure.append($script);
703
712
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/mg-substack",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-substack",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -27,15 +27,14 @@
27
27
  "dependencies": {
28
28
  "@tryghost/debug": "0.1.35",
29
29
  "@tryghost/errors": "1.3.8",
30
- "@tryghost/kg-default-cards": "10.1.5",
31
- "@tryghost/mg-fs-utils": "0.16.1",
30
+ "@tryghost/kg-default-cards": "10.2.0",
31
+ "@tryghost/mg-fs-utils": "0.16.2",
32
32
  "@tryghost/string": "0.2.17",
33
33
  "cheerio": "1.0.0-rc.12",
34
34
  "he": "1.2.0",
35
35
  "html-entities": "2.6.0",
36
36
  "lodash": "4.17.21",
37
37
  "simple-dom": "1.4.0",
38
- "srcset": "5.0.1"
39
- },
40
- "gitHead": "614571603585add8915fc853d0081208c2382a44"
38
+ "srcset": "5.0.2"
39
+ }
41
40
  }