@adobe/helix-html-pipeline 3.11.12 → 3.11.14

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
+ ## [3.11.14](https://github.com/adobe/helix-html-pipeline/compare/v3.11.13...v3.11.14) (2023-06-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * respect redirects on json pipeline ([#333](https://github.com/adobe/helix-html-pipeline/issues/333)) ([bd9b6e9](https://github.com/adobe/helix-html-pipeline/commit/bd9b6e9d5c98fd0094937b94f447042dc2b7e029)), closes [#223](https://github.com/adobe/helix-html-pipeline/issues/223)
7
+
8
+ ## [3.11.13](https://github.com/adobe/helix-html-pipeline/compare/v3.11.12...v3.11.13) (2023-06-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * remove type attribute from img tag ([#330](https://github.com/adobe/helix-html-pipeline/issues/330)) ([0272ea8](https://github.com/adobe/helix-html-pipeline/commit/0272ea8652e651581c1e29fd8ccd707fd1df3104)), closes [#319](https://github.com/adobe/helix-html-pipeline/issues/319)
14
+
1
15
  ## [3.11.12](https://github.com/adobe/helix-html-pipeline/compare/v3.11.11...v3.11.12) (2023-06-05)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "3.11.12",
3
+ "version": "3.11.14",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -81,7 +81,7 @@
81
81
  "@markedjs/html-differ": "4.0.2",
82
82
  "@semantic-release/changelog": "6.0.3",
83
83
  "@semantic-release/git": "10.0.1",
84
- "@semantic-release/npm": "10.0.3",
84
+ "@semantic-release/npm": "10.0.4",
85
85
  "c8": "7.14.0",
86
86
  "eslint": "8.42.0",
87
87
  "eslint-import-resolver-exports": "1.0.0-beta.5",
@@ -96,7 +96,7 @@
96
96
  "mocha": "10.2.0",
97
97
  "mocha-multi-reporters": "1.5.1",
98
98
  "remark-gfm": "3.0.1",
99
- "semantic-release": "21.0.3"
99
+ "semantic-release": "21.0.5"
100
100
  },
101
101
  "lint-staged": {
102
102
  "*.js": "eslint",
package/src/json-pipe.js CHANGED
@@ -44,7 +44,7 @@ export default function folderMapping(state) {
44
44
 
45
45
  async function fetchJsonContent(state, req, res) {
46
46
  const {
47
- owner, repo, ref, contentBusId, partition, s3Loader, log,
47
+ owner, repo, ref, contentBusId, partition, s3Loader, log, info,
48
48
  } = state;
49
49
  const { path } = state.info;
50
50
  let ret = await s3Loader.getObject('helix-content-bus', `${contentBusId}/${partition}${path}`);
@@ -53,6 +53,19 @@ async function fetchJsonContent(state, req, res) {
53
53
  if (ret.status === 404) {
54
54
  ret = await s3Loader.getObject('helix-code-bus', `${owner}/${repo}/${ref}${path}`);
55
55
  }
56
+
57
+ // check for redirect
58
+ const redirectLocation = ret.headers.get('x-amz-meta-redirect-location');
59
+ if (redirectLocation) {
60
+ res.status = 301;
61
+ res.body = '';
62
+ res.headers.delete('content-type');
63
+ res.headers.set('location', redirectLocation);
64
+ res.headers.set('x-surrogate-key', await computeSurrogateKey(`${contentBusId}${info.path}`));
65
+ res.error = 'moved';
66
+ return;
67
+ }
68
+
56
69
  if (ret.status === 200) {
57
70
  res.status = 200;
58
71
  delete res.error;
@@ -146,6 +159,9 @@ export async function jsonPipe(state, req) {
146
159
  await authenticate(state, req, res);
147
160
 
148
161
  if (res.error) {
162
+ if (res.status < 400) {
163
+ return res;
164
+ }
149
165
  throw new PipelineStatusError(res.status, res.error);
150
166
  }
151
167
 
@@ -56,7 +56,6 @@ export function createOptimizedPicture(src, alt = '', title = undefined) {
56
56
  loading: 'lazy',
57
57
  alt,
58
58
  'data-title': title === alt ? undefined : title,
59
- type: v.type,
60
59
  src: srcset,
61
60
  width,
62
61
  height,