@adobe/helix-md2docx 2.0.7 → 2.0.9
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.0.9](https://github.com/adobe/helix-md2docx/compare/v2.0.8...v2.0.9) (2022-10-06)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* prevent corrupt docx due to null images ([#150](https://github.com/adobe/helix-md2docx/issues/150)) ([af14630](https://github.com/adobe/helix-md2docx/commit/af14630a8feca383d5246d00b2b03c8e1a92d5fc)), closes [#144](https://github.com/adobe/helix-md2docx/issues/144)
|
|
7
|
+
|
|
8
|
+
## [2.0.8](https://github.com/adobe/helix-md2docx/compare/v2.0.7...v2.0.8) (2022-10-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @adobe/helix-docx2md to v1.1.4 ([#148](https://github.com/adobe/helix-md2docx/issues/148)) ([1878cb2](https://github.com/adobe/helix-md2docx/commit/1878cb21e8524b8d1d343c47aa30eef77c97d36f))
|
|
14
|
+
|
|
1
15
|
## [2.0.7](https://github.com/adobe/helix-md2docx/compare/v2.0.6...v2.0.7) (2022-10-05)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-md2docx",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "Helix Service that converts markdown to word documents",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"homepage": "https://github.com/adobe/helix-md2docx#readme",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@adobe/fetch": "3.1.4",
|
|
31
|
-
"@adobe/helix-docx2md": "1.1.
|
|
31
|
+
"@adobe/helix-docx2md": "1.1.4",
|
|
32
32
|
"@adobe/helix-markdown-support": "5.0.10",
|
|
33
33
|
"@adobe/helix-shared-process-queue": "1.1.5",
|
|
34
34
|
"docx": "7.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
47
|
-
"@adobe/helix-mediahandler": "1.2.
|
|
47
|
+
"@adobe/helix-mediahandler": "1.2.7",
|
|
48
48
|
"@semantic-release/changelog": "6.0.1",
|
|
49
49
|
"@semantic-release/exec": "6.0.3",
|
|
50
50
|
"@semantic-release/git": "10.0.1",
|
|
@@ -67,7 +67,7 @@ export default async function downloadImages(ctx, tree) {
|
|
|
67
67
|
const idx = String(count).padStart(2, ' ');
|
|
68
68
|
count += 1;
|
|
69
69
|
let buffer;
|
|
70
|
-
let type;
|
|
70
|
+
let type = 'application/octet-stream';
|
|
71
71
|
let maybeConvert;
|
|
72
72
|
let dimensions = {
|
|
73
73
|
width: 100,
|
|
@@ -105,14 +105,20 @@ export default async function downloadImages(ctx, tree) {
|
|
|
105
105
|
log.info(`[${idx}] ${ret.status} ${hsize(buffer.length).padStart(10)} ${type}`);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
maybeConvert = type !== 'image/png' && type !== 'image/jpg' && type !== 'image/jpeg' && type !== 'image/gif';
|
|
109
108
|
try {
|
|
110
109
|
dimensions = getDimensions(buffer);
|
|
110
|
+
type = mime.getType(dimensions.type);
|
|
111
111
|
} catch (e) {
|
|
112
112
|
maybeConvert = true;
|
|
113
113
|
log.warn(`[${idx}] Error detecting dimensions: ${e} ${type}`);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
if (!maybeConvert) {
|
|
117
|
+
// only convert unknown and images
|
|
118
|
+
maybeConvert = type === 'application/octet-stream'
|
|
119
|
+
|| (type.startsWith('image/') && type !== 'image/png' && type !== 'image/jpg' && type !== 'image/jpeg' && type !== 'image/gif');
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
let originalBuffer;
|
|
117
123
|
let originalType;
|
|
118
124
|
if (maybeConvert && image2png) {
|