Skip to content

Commit

Permalink
Make image proxy url work with relative base url (#3158)
Browse files Browse the repository at this point in the history
  • Loading branch information
cewald committed Jun 29, 2019
1 parent bb45ea1 commit 8dec06e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed product link in wishlist and microcart - @michasik (#2987)
- Resolve problem with getting CMS block from cache - @qiqqq (#2499)
- Make image proxy url work with relative base url - @cewald (#3158)

### Changed / Improved
- Shipping address is saved as default when not logged in user chooses to create account during checkout - @iwonapiotrowska (#2636)
Expand Down
3 changes: 2 additions & 1 deletion core/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export function getThumbnailPath (relativeUrl, width, height) {
} else {
let resultUrl
if (relativeUrl && (relativeUrl.indexOf('://') > 0 || relativeUrl.indexOf('?') > 0 || relativeUrl.indexOf('&') > 0)) relativeUrl = encodeURIComponent(relativeUrl)
let baseUrl = config.images.proxyUrl ? config.images.proxyUrl : config.images.baseUrl // proxyUrl is not a url base path but contains {{url}} parameters and so on to use the relativeUrl as a template value and then do the image proxy opertions
// proxyUrl is not a url base path but contains {{url}} parameters and so on to use the relativeUrl as a template value and then do the image proxy opertions
let baseUrl = processURLAddress(config.images.proxyUrl ? config.images.proxyUrl : config.images.baseUrl)
if (baseUrl.indexOf('{{') >= 0) {
baseUrl = baseUrl.replace('{{url}}', relativeUrl)
baseUrl = baseUrl.replace('{{width}}', width)
Expand Down

0 comments on commit 8dec06e

Please sign in to comment.