Skip to content

Commit

Permalink
[sitecore-jss-nextjs]: #607601 fixed unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruslan Matkovskyi committed Feb 6, 2024
1 parent 1933ae7 commit 5b89534
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Our versioning strategy is as follows:
* `[templates/nextjs-sxa]` Fixed Image component when there is using Banner variant which set property background-image when image is empty. ([#1689](https://github.com/Sitecore/jss/pull/1689)) ([#1692](https://github.com/Sitecore/jss/pull/1692))
* `[templates/nextjs-sxa]` Fix feature `show Grid column` in Experience Editor. ([#1704](https://github.com/Sitecore/jss/pull/1704))
* `[sitecore-jss-nextjs] [templates/nextjs-xmcloud]` SDK initialization rejections are now correctly handled. Errors should no longer occur after getSDK() promises resolve when they shouldn't (for example, getting Events SDK in development environment) ([#1712](https://github.com/Sitecore/jss/pull/1712) [#1715](https://github.com/Sitecore/jss/pull/1715) [#1716](https://github.com/Sitecore/jss/pull/1716))
* `[sitecore-jss-nextjs]` Fix redirects middleware for working with absolute url where is using site language context ([#1727](https://github.com/Sitecore/jss/pull/1727))

### 🛠 Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { debug } from '@sitecore-jss/sitecore-jss';
import { MiddlewareBase, MiddlewareBaseConfig } from './middleware';

const REGEXP_CONTEXT_SITE_LANG = new RegExp(/\$siteLang/, 'gi');
const REGEXP_CONTEXT_SITE_LANG = new RegExp(/\$siteLang/, 'i');
const REGEXP_ABSOLUTE_URL = new RegExp('^(?:[a-z]+:)?//', 'i');

/**
Expand Down Expand Up @@ -101,7 +101,10 @@ export class RedirectsMiddleware extends MiddlewareBase {
// Find context site language and replace token
if (
REGEXP_CONTEXT_SITE_LANG.test(existsRedirect.target) &&
!REGEXP_ABSOLUTE_URL.test(existsRedirect.target)
!(
REGEXP_ABSOLUTE_URL.test(existsRedirect.target) &&
existsRedirect.target.includes(hostname)
)
) {
existsRedirect.target = existsRedirect.target.replace(
REGEXP_CONTEXT_SITE_LANG,
Expand Down

0 comments on commit 5b89534

Please sign in to comment.