@adobe/helix-html-pipeline 5.1.0 → 5.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ## [5.1.2](https://github.com/adobe/helix-html-pipeline/compare/v5.1.1...v5.1.2) (2023-11-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * use crypto abstraction ([#453](https://github.com/adobe/helix-html-pipeline/issues/453)) ([618460d](https://github.com/adobe/helix-html-pipeline/commit/618460d3a32d753c947d5b91093c8955b689b89a))
7
+
8
+ ## [5.1.1](https://github.com/adobe/helix-html-pipeline/compare/v5.1.0...v5.1.1) (2023-11-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * append .plain.html in redirects if needed ([#452](https://github.com/adobe/helix-html-pipeline/issues/452)) ([d3035a1](https://github.com/adobe/helix-html-pipeline/commit/d3035a1f593b0ac39fd9bd2ce68c8bcb83fe06b4)), closes [#451](https://github.com/adobe/helix-html-pipeline/issues/451)
14
+ * increase test time ([336bda0](https://github.com/adobe/helix-html-pipeline/commit/336bda099dae3a3faea26c71984693a2cd3a998f))
15
+
1
16
  # [5.1.0](https://github.com/adobe/helix-html-pipeline/compare/v5.0.12...v5.1.0) (2023-11-06)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -10,7 +10,8 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  import { cleanupHeaderValue } from '@adobe/helix-shared-utils';
13
- import { createHash } from 'crypto';
13
+ // eslint-disable-next-line import/no-unresolved
14
+ import cryptoImpl from '#crypto';
14
15
  import { PipelineResponse } from './PipelineResponse.js';
15
16
  import fetchConfigAll from './steps/fetch-config-all.js';
16
17
  import setCustomResponseHeaders from './steps/set-custom-response-headers.js';
@@ -26,7 +27,7 @@ import { getOriginalHost } from './steps/utils.js';
26
27
  */
27
28
  function hashMe(domain, domainkeys) {
28
29
  return (Array.isArray(domainkeys) ? domainkeys : [domainkeys]).map((dk) => {
29
- const hash = createHash('sha256');
30
+ const hash = cryptoImpl.createHash('sha256');
30
31
  hash.update(domain);
31
32
  hash.update(dk);
32
33
  return hash.digest('hex');
@@ -37,10 +37,13 @@ export default async function fetchContent(state, req, res) {
37
37
  const ret = await state.s3Loader.getObject(bucketId, key);
38
38
 
39
39
  // check for redirect
40
- const redirectLocation = ret.headers.get('x-amz-meta-redirect-location');
40
+ let redirectLocation = ret.headers.get('x-amz-meta-redirect-location');
41
41
  if (redirectLocation) {
42
42
  res.status = 301;
43
43
  res.body = '';
44
+ if (redirectLocation.startsWith('/') && state.info.selector === 'plain') {
45
+ redirectLocation += '.plain.html';
46
+ }
44
47
  res.headers.set('location', redirectLocation);
45
48
  res.headers.set('x-surrogate-key', await computeSurrogateKey(`${contentBusId}${info.path}`));
46
49
  res.error = 'moved';