Skip to content

Commit 264417e

Browse files
committed
bug #1096 Don't store ux_live_component URLs in setTargetPath of the security component (gbere)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- Don't store ux_live_component URLs in setTargetPath of the security component Solves issue #1095 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | Fix #1095 | License | MIT Prevent to redirect to ux_live_component URL after login Commits ------- 9591ea8 Don't store ux_live_component URLs in setTargetPath of the security component
2 parents 8d5a9f1 + 9591ea8 commit 264417e

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Diff for: src/LiveComponent/assets/dist/live_controller.js

+1
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,7 @@ class RequestBuilder {
21542154
const fetchOptions = {};
21552155
fetchOptions.headers = {
21562156
Accept: 'application/vnd.live-component+html',
2157+
'X-Requested-With': 'XMLHttpRequest',
21572158
};
21582159
const totalFiles = Object.entries(files).reduce((total, current) => total + current.length, 0);
21592160
const hasFingerprints = Object.keys(children).length > 0;

Diff for: src/LiveComponent/assets/src/Backend/RequestBuilder.ts

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class {
2525
const fetchOptions: RequestInit = {};
2626
fetchOptions.headers = {
2727
Accept: 'application/vnd.live-component+html',
28+
'X-Requested-With': 'XMLHttpRequest',
2829
};
2930

3031
const totalFiles = Object.entries(files).reduce(

Diff for: src/LiveComponent/assets/test/Backend/RequestBuilder.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('buildRequest', () => {
1616
expect(fetchOptions.method).toEqual('GET');
1717
expect(fetchOptions.headers).toEqual({
1818
Accept: 'application/vnd.live-component+html',
19+
'X-Requested-With': 'XMLHttpRequest',
1920
});
2021
});
2122

@@ -38,6 +39,7 @@ describe('buildRequest', () => {
3839
expect(fetchOptions.headers).toEqual({
3940
Accept: 'application/vnd.live-component+html',
4041
'X-CSRF-TOKEN': '_the_csrf_token',
42+
'X-Requested-With': 'XMLHttpRequest',
4143
});
4244
const body = <FormData>fetchOptions.body;
4345
expect(body).toBeInstanceOf(FormData);
@@ -100,6 +102,7 @@ describe('buildRequest', () => {
100102
expect(fetchOptions.headers).toEqual({
101103
// no token
102104
Accept: 'application/vnd.live-component+html',
105+
'X-Requested-With': 'XMLHttpRequest',
103106
});
104107
const body = <FormData>fetchOptions.body;
105108
expect(body).toBeInstanceOf(FormData);
@@ -180,6 +183,7 @@ describe('buildRequest', () => {
180183
expect(fetchOptions.headers).toEqual({
181184
Accept: 'application/vnd.live-component+html',
182185
'X-CSRF-TOKEN': '_the_csrf_token',
186+
'X-Requested-With': 'XMLHttpRequest',
183187
});
184188
const body = <FormData>fetchOptions.body;
185189
expect(body).toBeInstanceOf(FormData);
@@ -204,6 +208,7 @@ describe('buildRequest', () => {
204208
expect(fetchOptions.headers).toEqual({
205209
Accept: 'application/vnd.live-component+html',
206210
'X-CSRF-TOKEN': '_the_csrf_token',
211+
'X-Requested-With': 'XMLHttpRequest',
207212
});
208213
const body = <FormData>fetchOptions.body;
209214
expect(body).toBeInstanceOf(FormData);

0 commit comments

Comments
 (0)