@sitecore-jss/sitecore-jss-nextjs 21.3.0-canary.16 → 21.3.0-canary.17
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.
|
@@ -61,21 +61,21 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
61
61
|
existsRedirect.target = existsRedirect.target.replace(REGEXP_CONTEXT_SITE_LANG, site.language);
|
|
62
62
|
}
|
|
63
63
|
const url = req.nextUrl.clone();
|
|
64
|
+
const parseURL = new URL(url.href);
|
|
64
65
|
const absoluteUrlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
65
66
|
if (absoluteUrlRegex.test(existsRedirect.target)) {
|
|
66
67
|
url.href = existsRedirect.target;
|
|
67
68
|
url.locale = req.nextUrl.locale;
|
|
68
69
|
}
|
|
69
70
|
else {
|
|
70
|
-
url.search = existsRedirect.isQueryStringPreserved ? url.search : '';
|
|
71
71
|
const urlFirstPart = existsRedirect.target.split('/')[1];
|
|
72
72
|
if (this.locales.includes(urlFirstPart)) {
|
|
73
73
|
url.locale = urlFirstPart;
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
url.pathname = existsRedirect.target;
|
|
74
|
+
existsRedirect.target = existsRedirect.target.replace(`/${urlFirstPart}`, '');
|
|
78
75
|
}
|
|
76
|
+
url.pathname = existsRedirect.target;
|
|
77
|
+
url.pathname = url.pathname.replace((0, regex_parser_1.default)(existsRedirect.pattern), existsRedirect.target);
|
|
78
|
+
url.href = `${parseURL.origin}/${url.pathname}${existsRedirect.isQueryStringPreserved ? '?' + url.search : ''}`;
|
|
79
79
|
}
|
|
80
80
|
const redirectUrl = decodeURIComponent(url.href);
|
|
81
81
|
/** return Response redirect with http code of redirect type **/
|
|
@@ -55,21 +55,21 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
55
55
|
existsRedirect.target = existsRedirect.target.replace(REGEXP_CONTEXT_SITE_LANG, site.language);
|
|
56
56
|
}
|
|
57
57
|
const url = req.nextUrl.clone();
|
|
58
|
+
const parseURL = new URL(url.href);
|
|
58
59
|
const absoluteUrlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
59
60
|
if (absoluteUrlRegex.test(existsRedirect.target)) {
|
|
60
61
|
url.href = existsRedirect.target;
|
|
61
62
|
url.locale = req.nextUrl.locale;
|
|
62
63
|
}
|
|
63
64
|
else {
|
|
64
|
-
url.search = existsRedirect.isQueryStringPreserved ? url.search : '';
|
|
65
65
|
const urlFirstPart = existsRedirect.target.split('/')[1];
|
|
66
66
|
if (this.locales.includes(urlFirstPart)) {
|
|
67
67
|
url.locale = urlFirstPart;
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
url.pathname = existsRedirect.target;
|
|
68
|
+
existsRedirect.target = existsRedirect.target.replace(`/${urlFirstPart}`, '');
|
|
72
69
|
}
|
|
70
|
+
url.pathname = existsRedirect.target;
|
|
71
|
+
url.pathname = url.pathname.replace(regexParser(existsRedirect.pattern), existsRedirect.target);
|
|
72
|
+
url.href = `${parseURL.origin}/${url.pathname}${existsRedirect.isQueryStringPreserved ? '?' + url.search : ''}`;
|
|
73
73
|
}
|
|
74
74
|
const redirectUrl = decodeURIComponent(url.href);
|
|
75
75
|
/** return Response redirect with http code of redirect type **/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "21.3.0-canary.
|
|
3
|
+
"version": "21.3.0-canary.17",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"react-dom": "^18.2.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@sitecore-jss/sitecore-jss": "^21.3.0-canary.
|
|
74
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "^21.3.0-canary.
|
|
75
|
-
"@sitecore-jss/sitecore-jss-react": "^21.3.0-canary.
|
|
73
|
+
"@sitecore-jss/sitecore-jss": "^21.3.0-canary.17",
|
|
74
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^21.3.0-canary.17",
|
|
75
|
+
"@sitecore-jss/sitecore-jss-react": "^21.3.0-canary.17",
|
|
76
76
|
"@vercel/kv": "^0.2.1",
|
|
77
77
|
"node-html-parser": "^6.1.4",
|
|
78
78
|
"prop-types": "^15.8.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"description": "",
|
|
83
83
|
"types": "types/index.d.ts",
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f2fc3d9b615dc300af7bf045ec7015f333bcb6cb",
|
|
85
85
|
"files": [
|
|
86
86
|
"dist",
|
|
87
87
|
"types",
|