@plone/volto 17.18.1 → 17.18.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 +6 -0
- package/package.json +3 -2
- package/packages/volto-slate/package.json +1 -1
- package/src/components/theme/View/View.jsx +4 -2
- package/src/components/theme/View/View.test.jsx +1 -0
- package/src/helpers/Api/Api.js +12 -0
- package/src/helpers/Api/Api.plone.rest.test.js +1 -0
- package/src/helpers/Api/Api.test.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,12 @@ myst:
|
|
|
17
17
|
|
|
18
18
|
<!-- towncrier release notes start -->
|
|
19
19
|
|
|
20
|
+
## 17.18.2 (2024-07-10)
|
|
21
|
+
|
|
22
|
+
### Bugfix
|
|
23
|
+
|
|
24
|
+
- Return a redirect response from Volto server-side rendering if the API request was redirected. @JeffersonBledsoe @mamico [#4854](https://github.com/plone/volto/issues/4854)
|
|
25
|
+
|
|
20
26
|
## 17.18.1 (2024-06-29)
|
|
21
27
|
|
|
22
28
|
### Bugfix
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "17.18.
|
|
12
|
+
"version": "17.18.2",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git@github.com:plone/volto.git"
|
|
@@ -187,7 +187,8 @@
|
|
|
187
187
|
"hooks": {
|
|
188
188
|
"before:bump": [
|
|
189
189
|
"yarn i18n",
|
|
190
|
-
"yarn build:types"
|
|
190
|
+
"yarn build:types",
|
|
191
|
+
"git add types"
|
|
191
192
|
],
|
|
192
193
|
"after:bump": [
|
|
193
194
|
"pipx run towncrier build --draft --yes --version ${version} > .changelog.draft && pipx run towncrier build --yes --version ${version}",
|
|
@@ -205,8 +205,10 @@ class View extends Component {
|
|
|
205
205
|
*/
|
|
206
206
|
render() {
|
|
207
207
|
const { views } = config;
|
|
208
|
-
if (
|
|
209
|
-
const redirect = flattenToAppURL(this.props.error.url)
|
|
208
|
+
if ([301, 302].includes(this.props.error?.code)) {
|
|
209
|
+
const redirect = flattenToAppURL(this.props.error.url)
|
|
210
|
+
.split('?')[0]
|
|
211
|
+
.replace('/++api++', '');
|
|
210
212
|
return <Redirect to={`${redirect}${this.props.location.search}`} />;
|
|
211
213
|
} else if (this.props.error && !this.props.connectionRefused) {
|
|
212
214
|
let FoundView;
|
package/src/helpers/Api/Api.js
CHANGED
|
@@ -80,6 +80,10 @@ class Api {
|
|
|
80
80
|
|
|
81
81
|
Object.keys(headers).forEach((key) => request.set(key, headers[key]));
|
|
82
82
|
|
|
83
|
+
if (__SERVER__ && checkUrl && ['get', 'head'].includes(method)) {
|
|
84
|
+
request.redirects(0);
|
|
85
|
+
}
|
|
86
|
+
|
|
83
87
|
if (data) {
|
|
84
88
|
request.send(data);
|
|
85
89
|
}
|
|
@@ -104,6 +108,14 @@ class Api {
|
|
|
104
108
|
url: request.xhr.responseURL,
|
|
105
109
|
});
|
|
106
110
|
}
|
|
111
|
+
|
|
112
|
+
if ([301, 302].includes(err?.status)) {
|
|
113
|
+
return reject({
|
|
114
|
+
code: err.status,
|
|
115
|
+
url: err.response.headers.location,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
107
119
|
return err ? reject(err) : resolve(response.body || response.text);
|
|
108
120
|
});
|
|
109
121
|
});
|