@tryghost/mg-linkfixer 0.5.10 → 0.5.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.
- package/lib/LinkFixer.js +6 -3
- package/package.json +6 -6
package/lib/LinkFixer.js
CHANGED
|
@@ -7,7 +7,7 @@ const htmlFields = ['html'];
|
|
|
7
7
|
|
|
8
8
|
const isHTMLField = field => _.includes(htmlFields, field);
|
|
9
9
|
|
|
10
|
-
class LinkFixer {
|
|
10
|
+
export default class LinkFixer {
|
|
11
11
|
constructor() {
|
|
12
12
|
this.linkMap = {};
|
|
13
13
|
}
|
|
@@ -44,6 +44,11 @@ class LinkFixer {
|
|
|
44
44
|
|
|
45
45
|
// @TODO: support for custom taxonomies
|
|
46
46
|
ctx.result.posts.forEach(({url, data}) => {
|
|
47
|
+
// Exit if no url or is empty string
|
|
48
|
+
if (!url || url.length === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
// Parse the current post URL, so we can use its domain as a fallback
|
|
48
53
|
const postURLDomain = new URL(url);
|
|
49
54
|
|
|
@@ -163,5 +168,3 @@ class LinkFixer {
|
|
|
163
168
|
return tasks;
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
|
-
|
|
167
|
-
export default LinkFixer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/mg-linkfixer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"repository": "https://github.com/TryGhost/migrate/tree/main/packages/mg-linkfixer",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@tryghost/listr-smart-renderer": "^0.5.
|
|
24
|
-
"eslint": "8.
|
|
25
|
-
"jest": "29.
|
|
26
|
-
"jest-extended": "
|
|
23
|
+
"@tryghost/listr-smart-renderer": "^0.5.11",
|
|
24
|
+
"eslint": "8.50.0",
|
|
25
|
+
"jest": "29.7.0",
|
|
26
|
+
"jest-extended": "4.0.1",
|
|
27
27
|
"listr": "0.14.3"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"cheerio": "1.0.0-rc.3",
|
|
31
31
|
"lodash": "4.17.21"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "666a72434beb865a7db4ec4890b0138c535d7d00"
|
|
34
34
|
}
|