@ecomplus/storefront-renderer 2.10.5 → 2.10.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.10.7](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-renderer@2.10.6...@ecomplus/storefront-renderer@2.10.7) (2023-05-20)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **renderer/proxy:** fix handling url on reverse proxy ([#904](https://github.com/ecomplus/storefront/issues/904)) ([15c4116](https://github.com/ecomplus/storefront/commit/15c411617b427fecaa618532d53cff3c245c4ae2))
11
+
12
+ ## [2.10.6](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-renderer@2.10.5...@ecomplus/storefront-renderer@2.10.6) (2023-05-12)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **renderer/image-size:** properly handling fallback dimensions ([e5953a1](https://github.com/ecomplus/storefront/commit/e5953a123087237b8407bd9aa4c3a87e46bf63f8))
17
+
6
18
  ## [2.10.5](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-renderer@2.10.4...@ecomplus/storefront-renderer@2.10.5) (2023-05-11)
7
19
 
8
20
  ### Bug Fixes
@@ -28,16 +28,14 @@ exports.ssr = (req, res, getCacheControl) => {
28
28
  )
29
29
  }
30
30
 
31
- const proxy = url => {
32
- const urlInstance = new URL(url)
33
- const requestUrl = urlInstance.searchParam.get('url')
31
+ const proxy = requestUrl => {
34
32
  if (requestUrl) {
35
- return axios.get(requestUrl, {
33
+ return axios.get(requestUrl, {
36
34
  headers,
37
35
  timeout: 3000,
38
36
  validateStatus: (status) => {
39
37
  return Boolean(status)
40
- }
38
+ }
41
39
  })
42
40
  }
43
41
  return null
@@ -65,7 +63,7 @@ exports.ssr = (req, res, getCacheControl) => {
65
63
 
66
64
  const fallback = () => {
67
65
  if (url.startsWith('/reverse-proxy/')) {
68
- proxy(url).then((response) => {
66
+ proxy(req.query.url).then((response) => {
69
67
  if (response) {
70
68
  const { status, headers, data } = response
71
69
  return res.writeHead(status, headers).send(data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomplus/storefront-renderer",
3
- "version": "2.10.5",
3
+ "version": "2.10.7",
4
4
  "description": "SSR for Storefront EJS views with E-Com Plus APIs",
5
5
  "main": "src/index.js",
6
6
  "repository": {
package/src/renderer.js CHANGED
@@ -110,14 +110,17 @@ cmsCollections.forEach(collection => {
110
110
 
111
111
  // abstracting comming image size handler for local images
112
112
  const tryImageSize = (src, fallbackDimensions = {}) => {
113
- let dimensions = fallbackDimensions
113
+ let dimensions = {}
114
114
  if (typeof src === 'string' && src.startsWith('/')) {
115
115
  try {
116
116
  dimensions = imageSize(`template/public${src}`)
117
117
  } catch (e) {
118
- dimensions = fallbackDimensions
118
+ dimensions = {}
119
119
  }
120
120
  }
121
+ if (fallbackDimensions && !dimensions.width && fallbackDimensions.width) {
122
+ return fallbackDimensions
123
+ }
121
124
  return dimensions
122
125
  }
123
126